yaotti's diary

Software is Eating the World

PCの細々としたこと

なぜかemobileが使えずオフラインだったので,普段不便だと思ってたことのカイゼンをした.

auto fetch

#!/bin/zsh
root=/path/to/git/projects/root  # modify me
for d in $(ls $root); do
    cd "$root/$d"
    git fetch
done

crontabに呼び出すよう書いておけば,気になってるプロジェクトのレポジトリ全てに対して適当にgit fetchしてくれる.
ちなみにcrontabは~/.crontabのようなファイルに書いて,

crontab ~/.crontab

とすると登録される.
こうすればcrontab -eと間違えてcrontab -rを押すみたいな惨事を招かずにすむのでおすすめです.編集と削除のオプションが隣り合わせにあるというのはひどい.

エイリアス

alias -g D="&& growlnotify done -m 'command successfully finished'"

コマンド終了して成功したらgrowl

#!/bin/zsh
git push $@
if [ $? = 0 ]; then
    growlnotify Succeed -a GitX -m 'successfully pushed'
else
    growlnotify Fail -a CyberDuck -m 'git push failed'
fi

push完了したらgrowlで成功/失敗を知らせる.
上のソースをパスの通ったところにgit-pushhhみたいな名前で保存すると,git pushhhで実行できる.
aオプション(growlのアイコン)のところはお好みで.