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:
parent
6f6280ca4a
commit
bf136ba0c1
@ -11,28 +11,27 @@
|
||||
|
||||
|
||||
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
|
||||
|
||||
[ "$1" = "-l" ] && shift && cmd="$git log"
|
||||
[ "$1" = "-lg" ] && shift && cmd="$git log --graph --format=short"
|
||||
[ "$1" = "-c" ] && shift && cmd="$git commit $@"
|
||||
[ "$1" = "-ca" ] && shift && cmd="$git commit -a"
|
||||
[ "$1" = "-cas" ] && shift && cmd="$git commit -S --amend $@"
|
||||
[ "$1" = "-ch" ] && shift && cmd="$git checkout $@"
|
||||
[ "$1" = "-mv" ] && shift && cmd="$git mv $@"
|
||||
[ "$1" = "-ps" ] && shift && cmd="$git push $@"
|
||||
[ "$1" = "-pl" ] && shift && cmd="$git pull"
|
||||
[ "$1" = "-a" ] && shift && cmd="$git add $@"
|
||||
[ "$1" = "-b" ] && shift && cmd="$git branch $@"
|
||||
[ "$1" = "-s" ] && shift && cmd="$git show $@"
|
||||
[ "$1" = "-rm" ] && shift && cmd="$git rm --cached $@"
|
||||
[ "$1" = "-rb" ] && shift && cmd="$git rebase $@"
|
||||
[ "$1" = "-rbi" ] && shift && cmd="$git rebase -i $@"
|
||||
[ "$1" = "-rs" ] && shift && cmd="$git reset --soft $@"
|
||||
[ "$1" = "-d" ] && shift && cmd="$git diff $@"
|
||||
if [ "$1" = "-m" ] ; then
|
||||
case $1 in
|
||||
-*)
|
||||
[ "$1" = "-l" ] && shift && cmd="$git log"
|
||||
[ "$1" = "-lg" ] && shift && cmd="$git log --graph --format=short"
|
||||
[ "$1" = "-c" ] && shift && cmd="$git commit $@"
|
||||
[ "$1" = "-ca" ] && shift && cmd="$git commit -a"
|
||||
[ "$1" = "-cas" ] && shift && cmd="$git commit -S --amend $@"
|
||||
[ "$1" = "-ch" ] && shift && cmd="$git checkout $@"
|
||||
[ "$1" = "-mv" ] && shift && cmd="$git mv $@"
|
||||
[ "$1" = "-ps" ] && shift && cmd="$git push $@"
|
||||
[ "$1" = "-pl" ] && shift && cmd="$git pull"
|
||||
[ "$1" = "-a" ] && shift && cmd="$git add $@"
|
||||
[ "$1" = "-b" ] && shift && cmd="$git branch $@"
|
||||
[ "$1" = "-s" ] && shift && cmd="$git show $@"
|
||||
[ "$1" = "-rm" ] && shift && cmd="$git rm --cached $@"
|
||||
[ "$1" = "-rb" ] && shift && cmd="$git rebase $@"
|
||||
[ "$1" = "-rbi" ] && shift && cmd="$git rebase -i $@"
|
||||
[ "$1" = "-rs" ] && shift && cmd="$git reset --soft $@"
|
||||
[ "$1" = "-d" ] && shift && cmd="$git diff $@"
|
||||
if [ "$1" = "-m" ] ; then
|
||||
shift
|
||||
[ "$1" = "" ] && echo "Please provide a branche to merge from" && exit 1
|
||||
if [ "$1" != "-a" ] ; then
|
||||
@ -49,6 +48,11 @@ if [ "$1" = "-m" ] ; then
|
||||
done
|
||||
fi
|
||||
cmd="$git checkout dev"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
[ "$1" != "" ] && cmd="$git $@" || cmd="$git status"
|
||||
;;
|
||||
esac
|
||||
|
||||
$cmd
|
||||
|
Reference in New Issue
Block a user