feat: improve dot as a real wrapper around git

`dot` can now take the exact same arguments as git, transparently
    -> flags are now optionnal
This commit is contained in:
David 2020-11-12 18:03:45 +01:00
parent 6f6280ca4a
commit bf136ba0c1
1 changed files with 40 additions and 36 deletions

View File

@ -11,10 +11,9 @@
git="/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME" git="/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME"
cmd="$git status" # by default, give the status
[ "$1" = "-g" ] && shift && cmd="$git $@" # make the wrapper transparent
case $1 in
-*)
[ "$1" = "-l" ] && shift && cmd="$git log" [ "$1" = "-l" ] && shift && cmd="$git log"
[ "$1" = "-lg" ] && shift && cmd="$git log --graph --format=short" [ "$1" = "-lg" ] && shift && cmd="$git log --graph --format=short"
[ "$1" = "-c" ] && shift && cmd="$git commit $@" [ "$1" = "-c" ] && shift && cmd="$git commit $@"
@ -50,5 +49,10 @@ if [ "$1" = "-m" ] ; then
fi fi
cmd="$git checkout dev" cmd="$git checkout dev"
fi fi
;;
*)
[ "$1" != "" ] && cmd="$git $@" || cmd="$git status"
;;
esac
$cmd $cmd