From cd67f7c51dcb681137ecbb819d3fcce124575f69 Mon Sep 17 00:00:00 2001 From: Ayo Date: Wed, 17 Sep 2025 10:57:13 +0200 Subject: [PATCH] feat(git): handle "other args" --- git.sh | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/git.sh b/git.sh index 9e1d11f..67f2bed 100755 --- a/git.sh +++ b/git.sh @@ -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