dotfiles/bin/giti

31 lines
No EOL
628 B
Bash
Executable file

#!/bin/sh
add() {
echo $1 >> .gitignore
}
del() {
sed -i "/$1/d" .gitignore
}
edit() {
sed -in "s|$1|$2|g" .gitignore
}
show() {
if [ -f '/usr/bin/bat' ]
then
bat .gitignore
else
cat .gitignore
fi
}
case "$1" in
add|a) shift; add "$@" ;;
del|d) shift; del "$@" ;;
mv) shift; edit "$@" ;;
show|s) shift; show ;;
help) echo "add/a - filename add to ignore"
echo "del/d - filename del from ignore"
echo "mv - oldname newname chage file name"
echo "show - show ignore file"
;;
*) echo "Command is not valid"
esac