Add script to simplify adding new scripts

This commit is contained in:
Alexander Gehrke 2022-04-13 13:14:28 +02:00
parent abf8978051
commit 64758003e4

16
add-new.zsh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/zsh
if git status --porcelain | grep -q '^A'; then
echo 'You have uncommited but staged changes. Aborting'
exit 1
fi
if [[ ! -e $1 ]]; then
echo "$1 not found"
exit 1
fi
if ! git status --porcelain -- $1 | grep -q '^\?\?'; then
echo "$1 already in repository"
exit 1
fi
git add $1
git commit -m "New script: $1"