From 704980fa2baf0e449be8e54378815b0ece13eb87 Mon Sep 17 00:00:00 2001 From: Jon Lewis Date: Sat, 27 Aug 2016 14:27:44 -0500 Subject: [PATCH] Temporary commit (moving computers) --- src/libSNS.src.sh | 5 ++++- src/sns.src.sh | 18 +++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/libSNS.src.sh b/src/libSNS.src.sh index a70c7bc..cc3ba27 100644 --- a/src/libSNS.src.sh +++ b/src/libSNS.src.sh @@ -152,7 +152,10 @@ function help { } function list(){ # This function, given a folder, $NOTE, will list the contents of $NOTE. - cd "$(dirname "$NOTES_DIR/$NOTE")" + # If not given a folder, it will list all notes in the store. + + if [ -z "$NOTEBOOK" ]; then NOTEBOOK="."; fi + cd "$(dirname "$NOTES_DIR/$NOTEBOOK")" find . -type f -name "*$EXT" | while read file; do printf "%s\n" "$file" done diff --git a/src/sns.src.sh b/src/sns.src.sh index 88f76b5..903e35d 100644 --- a/src/sns.src.sh +++ b/src/sns.src.sh @@ -94,11 +94,12 @@ fi #============================================================================== # Stage 2: Argument Parsing #============================================================================== -NOTE="" if [ -z "$1" ]; then help; exit 20 else + ARGS="$@" + declare -i INDEX INDEX=0 - while getopts ":cCd:xe:xl:xp:xhi" ARG $VCTL; do + while getopts ":cCd:e:lp:hi" ARG $VCTL; do let INDEX++ case "$ARG" in c|--create) @@ -123,7 +124,10 @@ else OP="TRUE" ;; l|--list) - LIST="TRUE" + echo "${ARGS[$INDEX]}" + NOTEBOOK="${ARGS[$INDEX]}" + + LIST="TRUE" OP="TRUE" ;; p|--print) @@ -160,10 +164,10 @@ fi fi # All options not requiring a note to be specified have been dealt # with; if one isn't specified, exit on ERR_NO_NOTE. -if [ -z "$NOTE" ]; then - printf "$RED_COLOR!$RESET_COLOR %s\n" "No note specified." - exit 30 -fi +#if [ -z "$NOTE" ]; then +# printf "$RED_COLOR!$RESET_COLOR %s\n" "No note specified." +# exit 30 +#fi if [ "$ENCRYPTION" == "TRUE" ]; then SESSION_ID="$RANDOM" #SESSION_ID later becomes the temporary filename