aboutsummaryrefslogtreecommitdiffstats
path: root/SOURCE/CORE/git.sh
diff options
context:
space:
mode:
authordanix <danix@danix.xyz>2023-04-18 08:47:37 +0200
committerdanix <danix@danix.xyz>2023-04-18 08:47:37 +0200
commitd1f115c1bcef830147519b1c3e950828b5626cdc (patch)
tree6ce978c553d03838b6f6ef48b247a82e0203e5ef /SOURCE/CORE/git.sh
parent1f4d77422386502ce5a67b101be6d6f16eff2175 (diff)
downloadbash-notes-d1f115c1bcef830147519b1c3e950828b5626cdc.tar.gz
bash-notes-d1f115c1bcef830147519b1c3e950828b5626cdc.zip
added git functionality to edit and remove options.
Diffstat (limited to 'SOURCE/CORE/git.sh')
-rw-r--r--SOURCE/CORE/git.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/SOURCE/CORE/git.sh b/SOURCE/CORE/git.sh
index bb51dc7..ff674df 100644
--- a/SOURCE/CORE/git.sh
+++ b/SOURCE/CORE/git.sh
@@ -62,6 +62,47 @@ gitadd() {
fi
}
+# edited note added to git and pushed it to remote
+gitedit() {
+ if [[ $USEGIT && -n $GITREMOTE ]]; then
+ [ $PLAIN == false ] && echo "Editing note on remote \"$GITREMOTE\""
+ cd $BASEDIR
+ $GIT add .
+ $GIT commit -m "$(basename $0) - ${GITCLIENT} note edited."
+ $GIT push origin master
+ else
+ # no git, so we just keep going
+ true
+ fi
+}
+
+# add note to git and push it to remote
+gitremove() {
+ NOTE=$1
+ FILE=$2
+ if [[ $USEGIT && -n $GITREMOTE ]]; then
+ [ $PLAIN == false ] && echo "Deleting notes from remote \"$GITREMOTE\""
+ if [ "all" == $NOTE ];then
+ echo "Deleting all notes"
+ cd $BASEDIR
+ $GIT rm notes/*
+ $GIT commit -m "$(basename $0) - ${GITCLIENT} removing all notes."
+ $GIT push origin master
+ else
+ echo "Deleting note ID ${NOTE}"
+ local OK=$(check_noteID "$NOTE")
+ cd $BASEDIR
+ $GIT rm notes/${FILE}
+ $GIT add .
+ $GIT commit -m "$(basename $0) - ${GITCLIENT} removing note ID ${NOTE}."
+ $GIT push origin master
+ fi
+ else
+ # no git, so we just keep going
+ true
+ fi
+}
+
# check for USEGIT and subsequent variables
if [[ $USEGIT && -n $GITREMOTE ]]; then
# GIT is a go.