Add script to simplify adding new scripts
This commit is contained in:
parent
abf8978051
commit
64758003e4
16
add-new.zsh
Executable file
16
add-new.zsh
Executable 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"
|
Loading…
Reference in a new issue