feat(git): handle "other args"

This commit is contained in:
Ayo Ayco 2025-09-17 10:57:13 +02:00
parent 2a74d2e273
commit cd67f7c51d

27
git.sh
View file

@ -9,9 +9,14 @@ command=$1
journal_dir="${notes_dir}/Journal"
month_dir=$(date +"%m %b")
git reset HEAD -- .
other_args="${@:2}"
echo $@
echo "args $other_args"
gitStatus() {
{
git add .
git add $other_args
git status
} || {
# Report; TODO: write log
@ -21,9 +26,9 @@ gitStatus() {
gitCommit() {
{
git add .
git add $other_args
read -p "Message: " message
git commit -m "$message" $*
git commit -m "$message" $other_args
}|| {
# Report; TODO: write log
echo ">>> Commit failed"
@ -40,23 +45,15 @@ gitPush() {
}
if [ "$1" = "diff" ] || [ "$1" = "d" ]; then
git add .
git add $other_args
git diff --staged
elif [ "$1" = "stat" ]; then
gitStatus
elif [ "$1" = "push" ]; then
gitPush
else
if [ "$1" = "g" ] || [ "$1" = "git" ]; then
git reset HEAD -- .
git add .
git status
gitCommit
else
git reset HEAD -- .
git add $*
git status
gitCommit $*
fi
git add $other_args
git status
gitCommit $other_args
gitPush
fi