danix
's git repository
home
/
my projects
/
bash-notes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3bd93e7
)
removed redundant query for notes details if not added from command line input.
author
danix
<danix@danix.xyz>
Wed, 26 Apr 2023 13:09:39 +0000
(15:09 +0200)
committer
danix
<danix@danix.xyz>
Wed, 26 Apr 2023 13:09:39 +0000
(15:09 +0200)
SOURCE/main.sh
patch
|
blob
|
blame
|
history
notes.sh
patch
|
blob
|
blame
|
history
diff --git
a/SOURCE/main.sh
b/SOURCE/main.sh
index
eaad776
..
18bebdf
100644
(file)
--- a/
SOURCE/main.sh
+++ b/
SOURCE/main.sh
@@
-1,5
+1,5
@@
# shellcheck disable=SC2006
# shellcheck disable=SC2006
-GOPT=$(getopt -o hvplr:
:a::e::d::s:: --long help,version,list,plain,userconf,showconf,sync::,restore::,backup::,add::,edit::,delete::,show:
: -n 'bash-notes' -- "$@")
+GOPT=$(getopt -o hvplr:
a:e:d:s: --long help,version,list,plain,userconf,showconf,sync,restore:,backup:,add:,edit:,delete:,show
: -n 'bash-notes' -- "$@")
# shellcheck disable=SC2181
if [ $? != 0 ] ; then helptext >&2 ; exit 1 ; fi
# shellcheck disable=SC2181
if [ $? != 0 ] ; then helptext >&2 ; exit 1 ; fi
@@
-27,84
+27,34
@@
while true; do
exit
;;
-a | --add )
exit
;;
-a | --add )
- case "$2" in
- '' )
- read -r -p "Title: " TITLE
- ;;
- * )
- TITLE=$2
- ;;
- esac
shift 2
addnote "$TITLE"
exit
;;
-e | --edit )
shift 2
addnote "$TITLE"
exit
;;
-e | --edit )
- case "$2" in
- '' )
- read -r -p "Note ID: " NOTE
- ;;
- * )
- NOTE=$2
- ;;
- esac
shift 2
editnote "$NOTE"
exit
;;
-d | --delete )
shift 2
editnote "$NOTE"
exit
;;
-d | --delete )
- case "$2" in
- '' )
- read -r -p "Note ID: " NOTE
- ;;
- * )
- NOTE=$2
- ;;
- esac
shift 2
rmnote "$NOTE"
exit
;;
-s | --show )
shift 2
rmnote "$NOTE"
exit
;;
-s | --show )
- case "$2" in
- '' )
- read -r -p "Note ID: " NOTE
- ;;
- * )
- NOTE=$2
- ;;
- esac
shift 2
shownote "$NOTE"
exit
;;
-r | --restore )
shift 2
shownote "$NOTE"
exit
;;
-r | --restore )
- case "$2" in
- '' )
- read -r -p "Backup Dir: " RDIR
- ;;
- * )
- RDIR=$2
- ;;
- esac
shift 2
backup_restore $RDIR
exit
;;
--sync )
shift 2
backup_restore $RDIR
exit
;;
--sync )
- case "$2" in
- '' )
- gitsync
- ;;
- '-f' )
- gitsync -f
- ;;
- * )
- helptext
- exit
- ;;
- esac
- shift 2
+ # I'm forcing it because if you run it manually, chances are that you need to.
+ gitsync -f
+ shift
exit
;;
--userconf )
exit
;;
--userconf )
@@
-119,14
+69,6
@@
while true; do
exit
;;
--backup )
exit
;;
--backup )
- case "$2" in
- '' )
- read -r -p "Backup Dir: " BDIR
- ;;
- * )
- BDIR=$2
- ;;
- esac
shift 2
backup_data $BDIR
exit
shift 2
backup_data $BDIR
exit
diff --git
a/notes.sh
b/notes.sh
index
5aa82c2
..
232effa
100755
(executable)
--- a/
notes.sh
+++ b/
notes.sh
@@
-612,7
+612,7
@@
shownote() {
fi
}
# shellcheck disable=SC2006
fi
}
# shellcheck disable=SC2006
-GOPT=$(getopt -o hvplr:
:a::e::d::s:: --long help,version,list,plain,userconf,showconf,sync::,restore::,backup::,add::,edit::,delete::,show:
: -n 'bash-notes' -- "$@")
+GOPT=$(getopt -o hvplr:
a:e:d:s: --long help,version,list,plain,userconf,showconf,sync,restore:,backup:,add:,edit:,delete:,show
: -n 'bash-notes' -- "$@")
# shellcheck disable=SC2181
if [ $? != 0 ] ; then helptext >&2 ; exit 1 ; fi
# shellcheck disable=SC2181
if [ $? != 0 ] ; then helptext >&2 ; exit 1 ; fi
@@
-640,84
+640,34
@@
while true; do
exit
;;
-a | --add )
exit
;;
-a | --add )
- case "$2" in
- '' )
- read -r -p "Title: " TITLE
- ;;
- * )
- TITLE=$2
- ;;
- esac
shift 2
addnote "$TITLE"
exit
;;
-e | --edit )
shift 2
addnote "$TITLE"
exit
;;
-e | --edit )
- case "$2" in
- '' )
- read -r -p "Note ID: " NOTE
- ;;
- * )
- NOTE=$2
- ;;
- esac
shift 2
editnote "$NOTE"
exit
;;
-d | --delete )
shift 2
editnote "$NOTE"
exit
;;
-d | --delete )
- case "$2" in
- '' )
- read -r -p "Note ID: " NOTE
- ;;
- * )
- NOTE=$2
- ;;
- esac
shift 2
rmnote "$NOTE"
exit
;;
-s | --show )
shift 2
rmnote "$NOTE"
exit
;;
-s | --show )
- case "$2" in
- '' )
- read -r -p "Note ID: " NOTE
- ;;
- * )
- NOTE=$2
- ;;
- esac
shift 2
shownote "$NOTE"
exit
;;
-r | --restore )
shift 2
shownote "$NOTE"
exit
;;
-r | --restore )
- case "$2" in
- '' )
- read -r -p "Backup Dir: " RDIR
- ;;
- * )
- RDIR=$2
- ;;
- esac
shift 2
backup_restore $RDIR
exit
;;
--sync )
shift 2
backup_restore $RDIR
exit
;;
--sync )
- case "$2" in
- '' )
- gitsync
- ;;
- '-f' )
- gitsync -f
- ;;
- * )
- helptext
- exit
- ;;
- esac
- shift 2
+ # I'm forcing it because if you run it manually, chances are that you need to.
+ gitsync -f
+ shift
exit
;;
--userconf )
exit
;;
--userconf )
@@
-732,14
+682,6
@@
while true; do
exit
;;
--backup )
exit
;;
--backup )
- case "$2" in
- '' )
- read -r -p "Backup Dir: " BDIR
- ;;
- * )
- BDIR=$2
- ;;
- esac
shift 2
backup_data $BDIR
exit
shift 2
backup_data $BDIR
exit