9d06a61780
Kept wondering wether I should keep the MIT (because I highly value freedom of act) or embrace the GPL (because I don't want this work to become close-source). I do understand that this commit (and the next one that is actually changing the LICENSE) is a defeat for freedom. I guess freedom has been defeated long time ago, when people and companies figured that was "free" (as in gratis) was also "free" (as in disposable). This is not how I think free (as in "libre") works but hey, that surely is how Intel and other corporations see it (ec: Intel Management Engine is entirely based on Minix, is close-source, and *maybe* used as a backdoor by anybody). It boils down to the Paradox of Tolerance, and I surely won't tolerate shit going their way. If you want to take open source stuff, be my guest ; but you have to play by the rules.
67 lines
2.1 KiB
Bash
Executable File
67 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
######################################################################
|
|
# @author : swytch
|
|
# @file : dot
|
|
# @license : GPLv3
|
|
# @created : Wednesday May 20, 2020 18:13:05 CEST
|
|
#
|
|
# @description : git wrapper for dotfiles management
|
|
######################################################################
|
|
|
|
flags="false"
|
|
for arg in $@
|
|
do
|
|
case $arg in
|
|
--*) ;;
|
|
-*) [ "$flags" = "true" ] && flags="error" && break || flags="true" ;;
|
|
esac
|
|
done
|
|
|
|
[ "$flags" = "error" ] && echo "error: only one flag permitted" && exit 1
|
|
|
|
git="/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME"
|
|
|
|
case $1 in
|
|
-*)
|
|
[ "$1" = "-l" ] && cmd="$git log" && break
|
|
[ "$1" = "-lg" ] && cmd="$git log --graph --format=short" && break
|
|
[ "$1" = "-c" ] && shift && cmd="$git commit $@" && break
|
|
[ "$1" = "-ca" ] && cmd="$git commit -a" && break
|
|
[ "$1" = "-cas" ] && shift && cmd="$git commit -S --amend $@" && break
|
|
[ "$1" = "-ch" ] && shift && cmd="$git checkout $@" && break
|
|
[ "$1" = "-mv" ] && shift && cmd="$git mv $@" && break
|
|
[ "$1" = "-ps" ] && shift && cmd="$git push $@" && break
|
|
[ "$1" = "-pl" ] && cmd="$git pull" && break
|
|
[ "$1" = "-a" ] && shift && cmd="$git add $@" && break
|
|
[ "$1" = "-b" ] && shift && cmd="$git branch $@" && break
|
|
[ "$1" = "-s" ] && shift && cmd="$git show $@" && break
|
|
[ "$1" = "-rm" ] && shift && cmd="$git rm --cached $@" && break
|
|
[ "$1" = "-rb" ] && shift && cmd="$git rebase $@" && break
|
|
[ "$1" = "-rbi" ] && shift && cmd="$git rebase -i $@" && break
|
|
[ "$1" = "-rs" ] && shift && cmd="$git reset --soft $@" && break
|
|
[ "$1" = "-d" ] && shift && cmd="$git diff $@" && break
|
|
if [ "$1" = "-m" ] ; then
|
|
shift
|
|
[ "$1" = "" ] && echo "Please provide a branche to merge into" && exit 1
|
|
if [ "$1" != "-a" ] ; then
|
|
while [ "$1" != "" ] ; do
|
|
$git checkout $1 && $git merge dev
|
|
shift
|
|
done
|
|
else
|
|
branches="$(echo "$($git branch)" | sed -e 's/\*/ /;t')"
|
|
for arg in $branches ; do
|
|
[ "$arg" != "dev" ] && $git checkout $arg && $git merge dev
|
|
done
|
|
fi
|
|
cmd="$git checkout dev"
|
|
fi
|
|
;;
|
|
*)
|
|
[ "$1" != "" ] && cmd="$git $@" || cmd="$git status"
|
|
;;
|
|
esac
|
|
|
|
$cmd
|