X-Git-Url: https://git.danix.xyz/?p=bash-notes.git;a=blobdiff_plain;f=notes.sh;h=fa54baec03fc4d4316cf6c4dff2f7a4c71460ad5;hp=edec94d5f54d50d6951af2f703f6829cc5b3c8b8;hb=c018122c134d4a9dafe623425f768e15da94ca57;hpb=44abbfe7d30b1a3460500aef77bc6f4b7b3b95fa
diff --git a/notes.sh b/notes.sh
index edec94d..fa54bae 100644
--- a/notes.sh
+++ b/notes.sh
@@ -58,7 +58,7 @@ echo $PID > $PIDFILE
function helptext() {
echo "Usage:"
- echo " $0 [OPTION] ..."
+ echo " $0 [PARAMS] ..."
echo ""
cat << __NOWCONF__
${BASENAME} configuration is:
@@ -67,6 +67,7 @@ base directory: ${BASEDIR}/
notes archive: ${NOTESDIR}/
notes database: ${DB}
rc file: $RCFILE
+
text editor: ${EDITOR}
terminal: ${TERMINAL}
jq executable: ${JQ}
@@ -75,6 +76,8 @@ __NOWCONF__
echo ""
echo "The script's parameters are:"
echo " -h | --help : This help text"
+ echo " -p | --plain : Output is in plain text"
+ echo " (without this option the output is colored)"
echo " -l | --list : List existing notes"
echo " -a | --add
: Add new note"
echo " -m | --modify : Modify note"
@@ -98,6 +101,7 @@ function addnote() {
function listnotes() {
echo "listing all notes"
+ [ $PLAIN == true ] && echo "output is plain text" || echo "output is colored"
echo ""
echo "[ID] [TITLE]"
for i in ${NOTESDIR}/*; do
@@ -197,7 +201,7 @@ fi
# NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install this
# separately; see below.
-GOPT=`getopt -o hvla:m:d:r: --long help,version,list,userconf,add:,modify:,date:,remove:,editor:,storage: \
+GOPT=`getopt -o hvpla:m:d:r: --long help,version,list,plain,userconf,add:,modify:,date:,remove:,editor:,storage: \
-n 'bash-notes' -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
@@ -205,6 +209,8 @@ if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$GOPT': they are essential!
eval set -- "$GOPT"
+PLAIN=false
+
while true; do
case "$1" in
-h | --help )
@@ -215,6 +221,10 @@ while true; do
echo $BASENAME v${VERSION}
exit
;;
+ -p | --plain )
+ PLAIN=true
+ shift
+ ;;
-l | --list )
listnotes
exit