Testing:
Print function works
This commit is contained in:
Jon-William Lewis
2015-03-18 14:53:05 -05:00
parent 45717e33b5
commit a0ad2e7d48
16 changed files with 389 additions and 398 deletions

View File

@@ -2,12 +2,9 @@
# Section: Configuration
#==============================================================================
if [ -r $HOME/.sns/sns.conf ]; then
source $HOME/.sns/sns.conf
source $HOME/.sns/sns.conf
else
ROOTDIR=$HOME/.sns
BASEDIR=$ROOTDIR/notes
EDITOR=vim
EXT=note
init_default_config
fi
if [ "$ENCRYPTION" == "TRUE" ]; then

View File

@@ -8,7 +8,7 @@ SECTION=""
if [ -z "$1" ]; then #If no input was given, print help
help
exit
exit 20
else #Assume the user wants to do something.
ARGS=( "$@" )
for ARG in ${ARGS[@]};do
@@ -23,18 +23,22 @@ else #Assume the user wants to do something.
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
if [ -n "$NAME" -a -z "$NOTEBOOK" ]; then
NOTEBOOK="$NAME"
NAME=""
fi
fi
# Note: writeconf has highest priority, and it is the only function that can
# work without any parameters.
#==============================================================================
# End Section: Argument Parsing
#==============================================================================

View File

@@ -1,22 +1,30 @@
# Help requires no arguments, and is exclusive.
if [ -n "$HELP" ]; then help; exit 0; fi
# If no name or notebook is specified, the create, edit, and print functions will not function properly.
# Check $NAME and $NOTEBOOK and exit if either are empty.
if [ -z "$NAME" -o -z "$NOTEBOOK" ]; then;
echo " ERROR: Insufficient arguments";
help; #Remind the user how to use the script
exit 10;
# List only requires a notebook, and is exclusive.
if [ -z "$NOTEBOOK" ]; then
echo " ERROR: Insufficient arguments:"
echo " Notebook not specified"
exit 30
fi
if [ -n "$LIST" ]; then
list
exit 0
fi
#All other functions require a note title and notebook.
if [ -z "$NAME" ]; then
echo " ERROR: Insufficient arguments:"
echo " Title not specified"
exit 30
fi
NOTEDIR=$BASEDIR/$NOTEBOOK/$SECTION/
NOTE=$NOTEDIR$NAME.$EXT
if [ "$ENCRYPTION" == "TRUE" ]; then
NOTE=$NOTE.tmp
fi
if [ "$ENCRYPTION" == "TRUE" ]; then NOTE=$NOTE.tmp fi