feat(git): default action as status, commit, push
This commit is contained in:
parent
2b7bc58e47
commit
c95eb99479
1 changed files with 18 additions and 4 deletions
22
git.sh
22
git.sh
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue