From c95eb9947944e31a2cb5638a3d18fb6440d1256c Mon Sep 17 00:00:00 2001 From: Ayo Date: Mon, 23 Jun 2025 12:28:58 +0200 Subject: [PATCH] feat(git): default action as status, commit, push --- git.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/git.sh b/git.sh index 9787cd1..0a9087d 100755 --- a/git.sh +++ b/git.sh @@ -9,7 +9,7 @@ command=$1 journal_dir="${notes_dir}/Journal" month_dir=$(date +"%m %b") -if [ "$1" = "stat" ]; then +gitStatus() { { git add . git status @@ -17,7 +17,9 @@ if [ "$1" = "stat" ]; then # Report; TODO: write log echo ">>> Stat failed" } -elif [ "$1" = "commit" ]; then +} + +gitCommit() { { git add . read -p "Message: " message @@ -26,13 +28,25 @@ elif [ "$1" = "commit" ]; then # Report; TODO: write log echo ">>> Commit failed" } -elif [ "$1" = "push" ]; then +} + +gitPush() { { git push } || { # Report; TODO: write log echo ">>> Push failed" } +} + +if [ "$1" = "stat" ]; then + gitStatus +elif [ "$1" = "commit" ]; then + gitCommit +elif [ "$1" = "push" ]; then + gitPush else - echo "git tools" + gitStatus + gitCommit + gitPush fi