linux homebrew skill 技巧

$ cat /usr/bin/gitdiffH0
#!/bin/bash
git diff HEAD $(git ls-files| grep '\.py$\|\.py\.in$') | osflake8 --diff

$ cat /usr/bin/gitdiffH1
#!/bin/bash
git diff HEAD~ $(git ls-files| grep '\.py$\|\.py\.in$') | flake8 --diff

 

$ cat mytest
python -m unittest $*

 

$ cat run_list_test
#!/bin/bash
python -m testtools.run discover --load-list my-list

 

$ cat mysubstitue
#!/bin/bash
EXP="s/$1/$2/"
echo $EXP
git grep "$1" |cut -d ":" -f 1|uniq
git grep "$1" |cut -d ":" -f 1|uniq | xargs sed -i -e "$EXP"

 

$ cat gen_test_list
#!/bin/bash
# testr list-tests test_stack_authorize_stack_user_nocreds > my-list
testr list-tests $@ > my-list

 

$ cat modify_files
git $@ --stat | grep "\|\s\+[1-9]" | cut -d "|" -f1
# git show --stat | grep "\|\s\+[1-9]" | cut -d "|" -f1 | grep .*.py | xargs sed -i -e "s/ResourceData.get\>/ResourceData.get_obj/"

 

$ cat mygit

#!/bin/bash
for x in *
    do
        # if [ -f $x ] || [ "x$x" = "xstatus" ] || [ "x$x" = "xdata" ]; then
        if [ -f $x ]; then
            continue
        fi
        cd $x
        if [ -e ".git" ]; then
            echo "---------------enter $x ------------------"
            git $@
        fi
        cd -
    done

 

posted @ 2017-12-11 15:43  lvmxh  阅读(225)  评论(0编辑  收藏  举报