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.
41 lines
1.6 KiB
Bash
41 lines
1.6 KiB
Bash
#==============================================================================
|
|
# 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
|
|
#==============================================================================
|