Added sleep 1 sec after deleting notes to allow the user to read the
[bash-notes.git] / notes.sh
index 6c81615..d0fd902 100755 (executable)
--- a/notes.sh
+++ b/notes.sh
@@ -161,7 +161,7 @@ function check_noteID() {
 
 function helptext() {
     echo "Usage:"
-    echo "  $0 [PARAMS] ..."
+    echo "  $0 [PARAMS] [note ID]..."
        echo ""
     echo "${BASENAME} parameters are:"
     echo -e "  -h | --help\t\t\t: This help text"
@@ -178,6 +178,7 @@ function helptext() {
     echo -e "  --userconf\t\t\t: Export User config file"
     echo -e "  --backup [<dest>]\t\t: Backup your data in your destination folder"
     echo ""
+    echo -e "if a non option is passed and is a valid note ID, the note will be displayed."
 }
 
 function configtext() {
@@ -378,6 +379,7 @@ function rmnote() {
                if [ ! "$OK" ]; then
                        echo "invalid note \"$NOTE\""
                        echo "Use the note ID that you can fetch after listing your notes"
+                       sleep 1
                        exit 1
                fi
 
@@ -392,8 +394,11 @@ function rmnote() {
                        mv $TMPDB $DB
                        rm $NOTESDIR/$FILE
                        echo "Deleted note $TITLE"
+                       sleep 1
+                       exit
                else
                         echo "note not found"
+                        sleep 1
                         exit 1
                fi
        fi
@@ -537,3 +542,12 @@ while true; do
                        ;;
        esac
 done
+
+for arg; do
+       if [ $(check_noteID $arg) ]; then
+               shownote $arg
+       else
+               helptext
+               exit
+       fi
+done