77# The idea came from 'pass' the standard Unix password manager
88
99# VARIABLES
10- VERSION=2.1
10+ VERSION=2.5
1111# NOTES_UMASK='077'
1212# Handle $XDG_DATA_DIR -or- NOTESDIR being set in environment
1313if [ -n " $XDG_DATA_DIR " -a -z " $NOTESDIR " ] ; then
4343 SHREDCMD=" rm"
4444fi
4545
46- USEGIT=` grep git ${CONFIGFILE} | cut -d' =' -f 2`
46+ USEGIT=" ` grep git ${CONFIGFILE} | cut -d' =' -f 2` "
4747
48- SPELLCHECK= ` grep spelling $CONFIGFILE | cut -d ' = ' -f 2 `
49- spellcheck () {
48+ spell_check () {
49+ SPELLCHECK= " ` grep spelling ${CONFIGFILE} | cut -d ' = ' -f 2 ` "
5050 case ${SPELLCHECK} in
5151 aspell)
52- SPELLINGCMD=" aspell -x -c "
53- ${SPELLINGCMD} ${notefile}
52+ aspell -x -c ${notefile}
5453 ;;
5554 ispell)
56- SPELLINGCMD=" ispell -x "
57- ${SPELLINGCMD} ${notefile}
55+ ispell -x ${notefile}
5856 ;;
59- none)
60- ;;
61- * )
62- echo Invalid config option ` grep " spellcheck" ${CONFIGFILE} `
6357 esac
6458}
6559
@@ -93,10 +87,6 @@ cmd_init (){ # setup directories and GPG key to be used
9387
9488 echo " Creating Journal directory ${JOURNALDIR} "
9589 mkdir -p $JOURNALDIR
96-
97- echo params $1
98-
99-
10090}
10191
10292create_config () {
@@ -124,7 +114,7 @@ create_config () {
124114 echo Do you want spellchecking enabled?
125115 echo " 1) Use aspell"
126116 echo " 2) Use ispell"
127- echo " 3) Do not spellcheck "
117+ echo " 3) Do not spell check "
128118 read -p " Choose 1,2,or 3: " choosespell
129119 case $choosespell in
130120 1)
@@ -209,7 +199,12 @@ note_add () {
209199 filen=" $@ "
210200 notefile=" ${USE_POINTER} /` echo ${filen} | tr ' ' ' _' ` "
211201
212- if [ -f " $notefile .asc" ] ; then
202+ if [ " $filen " = " " ] ; then
203+ echo No notefile name given ... exiting
204+ exit 1
205+ fi
206+
207+ if [ -f " ${notefile} .asc" ] ; then
213208 echo File exists ... cannot create. Try ' notes edit' instead.
214209 exit 1
215210 else
@@ -220,7 +215,7 @@ note_add () {
220215 # create temporary note file
221216 $EDITOR " $notefile "
222217
223- spellcheck
218+ spell_check
224219
225220 # encrypt note file
226221 $GPG -ear $KEY $GPG_OPTS " $notefile "
@@ -278,13 +273,13 @@ note_edit () {
278273 if [ -f " $notefile " ]; then
279274 gpg -d -o " ${decrypted} " " ${notefile} "
280275 ${EDITOR} " ${decrypted} "
281- spellcheck
276+ spell_check
282277 $GPG -ear $KEY $GPG_OPTS " ${decrypted} "
283278 ${SHREDCMD} ${decrypted}
284279 elif [ -f " ${notefile} .asc" ]; then
285280 gpg -d -o " ${decrypted} " " ${notefile} .asc"
286281 ${EDITOR} " ${decrypted} "
287- spellcheck
282+ spell_check
288283 $GPG -ear $KEY $GPG_OPTS " ${decrypted} "
289284 ${SHREDCMD} ${decrypted}
290285 else
@@ -390,15 +385,7 @@ notebook_delete () {
390385 echo Error: Notebook \' $notebook \' does not exist
391386 exit 1
392387 else
393- echo Deleting files from $notebook
394- ${SHREDCMD} ${notebook} /* .asc
395-
396- if [ $? = 0 ] ; then
397- rmdir " $notebook "
398- else
399- echo Deleting files aborted ... aborting deleting notebook $notebook
400- exit 1
401- fi
388+ rm -rf $notebook
402389 fi
403390
404391 if [ " $USEGIT " = " y" ]; then
@@ -468,7 +455,7 @@ GPG encrypted notes system for BSD and Linux systems
468455
469456 notes init initialise notes system
470457 notes config display config file
471- notes backup backup $ NOTESDIR to GPG encrypted tar file
458+ notes backup backup NOTESDIR to GPG encrypted tar file
472459 notes newkey email change GPG key
473460 notes help show help
474461 notes version show version
@@ -638,7 +625,7 @@ cmd_default () {
638625
639626 if [ " $nb " = " " ] ; then
640627 echo Default notebook = " ` readlink -f $DEFAULT_POINTER ` "
641- exit 0
628+ return 0
642629 fi
643630 if [ -d " $notebook " ] ; then
644631 unlink " $DEFAULT_POINTER "
@@ -664,7 +651,7 @@ cmd_use () {
664651 echo no notebook specified using default notebook
665652 unlink " $USE_POINTER "
666653 ln -s " ` basename $defaultnbval ` " " $USE_POINTER "
667- exit 0
654+ return 0
668655 fi
669656 if [ -d " $notebook " ] ; then
670657 unlink " $USE_POINTER "
@@ -779,6 +766,5 @@ case "$1" in
779766 git) shift ; cmd_git " $@ " ;;
780767 * ) cmd_extension_or_show " $@ " ;;
781768esac
782- exit 0
783769
784770
0 commit comments