feat(git): default action as status, commit, push

This commit is contained in:
Ayo Ayco 2025-06-23 12:28:58 +02:00
parent 2b7bc58e47
commit c95eb99479

22
git.sh
View file

@ -9,7 +9,7 @@ command=$1
journal_dir="${notes_dir}/Journal" journal_dir="${notes_dir}/Journal"
month_dir=$(date +"%m %b") month_dir=$(date +"%m %b")
if [ "$1" = "stat" ]; then gitStatus() {
{ {
git add . git add .
git status git status
@ -17,7 +17,9 @@ if [ "$1" = "stat" ]; then
# Report; TODO: write log # Report; TODO: write log
echo ">>> Stat failed" echo ">>> Stat failed"
} }
elif [ "$1" = "commit" ]; then }
gitCommit() {
{ {
git add . git add .
read -p "Message: " message read -p "Message: " message
@ -26,13 +28,25 @@ elif [ "$1" = "commit" ]; then
# Report; TODO: write log # Report; TODO: write log
echo ">>> Commit failed" echo ">>> Commit failed"
} }
elif [ "$1" = "push" ]; then }
gitPush() {
{ {
git push git push
} || { } || {
# Report; TODO: write log # Report; TODO: write log
echo ">>> Push failed" echo ">>> Push failed"
} }
}
if [ "$1" = "stat" ]; then
gitStatus
elif [ "$1" = "commit" ]; then
gitCommit
elif [ "$1" = "push" ]; then
gitPush
else else
echo "git tools" gitStatus
gitCommit
gitPush
fi fi