Simple Note System v2.0a2
Changes: Split script into several different files for easier editting Added build.sh to compile Simple Note System from tree Changed config file to config folder; $HOME/.sns now contains configuration and notes Testing: Script runs and produces help screen; no further testing done.
This commit is contained in:
40
init/stage2.sns.sh
Normal file
40
init/stage2.sns.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#==============================================================================
|
||||
# Section: Argument Parsing
|
||||
#==============================================================================
|
||||
|
||||
NAME=""
|
||||
NOTEBOOK=""
|
||||
SECTION=""
|
||||
|
||||
if [ -z "$1" ]; then #If no input was given, print help
|
||||
help
|
||||
exit
|
||||
else #Assume the user wants to do something.
|
||||
ARGS=( "$@" )
|
||||
for ARG in ${ARGS[@]};do
|
||||
if [ "$ARG" = "-c" -o "$ARG" = "--create" ]; then CREATE="TRUE"
|
||||
elif [ "$ARG" = "-d" -o "$ARG" = "--delete" ]; then DELETE="TRUE"
|
||||
elif [ "$ARG" = "-e" -o "$ARG" = "--edit" ]; then EDIT="TRUE"
|
||||
elif [ "$ARG" = "-ce" -o "$ARG" = "-ec" ]; then EDIT="TRUE";CREATE="TRUE"
|
||||
elif [ "$ARG" = "-p" -o "$ARG" = "--print" ]; then PRINT="TRUE"
|
||||
elif [ "$ARG" = "-l" -o "$ARG" = "--list" ]; then LIST="TRUE"
|
||||
elif [ "$ARG" = "-h" -o "$ARG" == "--help" ]; then help; exit 0
|
||||
elif [ "$ARG" = "-w" -o "$ARG" == "--wconf" ]; then writeconf; exit
|
||||
else
|
||||
if [ -z "$NAME" -a -n $ARG ]; then
|
||||
NAME=$ARG
|
||||
echo "Name: $NAME"
|
||||
elif [ -z "$NOTEBOOK" -a -n $ARG ]; then
|
||||
NOTEBOOK=$ARG
|
||||
echo "Notebook: $NOTEBOOK"
|
||||
elif [ -z "$SECTION" -a -n $ARG ]; then
|
||||
SECTION=$ARG
|
||||
echo "Section: $SECTION"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
#==============================================================================
|
||||
# End Section: Argument Parsing
|
||||
#==============================================================================
|
||||
Reference in New Issue
Block a user