reimplemented title dialog when adding note if nothing is passed on the command line.
[bash-notes.git] / SOURCE / main.sh
index 18bebdf..c2822d9 100644 (file)
@@ -1,5 +1,5 @@
 # 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
@@ -27,26 +27,31 @@ while true; do
                        exit
                ;;
            -a | --add )
+                       TITLE=$2
                        shift 2
                        addnote "$TITLE"
                        exit
                ;;
                -e | --edit )
+                       NOTE=$2
                        shift 2
                        editnote "$NOTE"
                        exit
                        ;;
                -d | --delete )
+                       NOTE=$2
                        shift 2
                        rmnote "$NOTE"
                        exit
                        ;;
                -s | --show )
+                       NOTE=$2
                        shift 2
                        shownote "$NOTE"
                        exit
                        ;;
                -r | --restore )
+                       RDIR=$2
                        shift 2
                        backup_restore $RDIR
                        exit
@@ -69,6 +74,7 @@ while true; do
                        exit
                        ;;
                --backup )
+                       BDIR=$2
                        shift 2
                        backup_data $BDIR
                        exit