danix
's git repository
home
/
my projects
/
bash-notes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
44abbfe
)
added 'plain' parameter to output plain text without markup
author
danix
<danix@danix.xyz>
Fri, 24 Mar 2023 15:50:37 +0000
(16:50 +0100)
committer
danix
<danix@danix.xyz>
Fri, 24 Mar 2023 15:50:37 +0000
(16:50 +0100)
notes.sh
patch
|
blob
|
blame
|
history
diff --git
a/notes.sh
b/notes.sh
index
edec94d
..
fa54bae
100644
(file)
--- a/
notes.sh
+++ b/
notes.sh
@@
-58,7
+58,7
@@
echo $PID > $PIDFILE
function helptext() {
echo "Usage:"
function helptext() {
echo "Usage:"
- echo " $0 [
OPTION
] ..."
+ echo " $0 [
PARAMS
] ..."
echo ""
cat << __NOWCONF__
${BASENAME} configuration is:
echo ""
cat << __NOWCONF__
${BASENAME} configuration is:
@@
-67,6
+67,7
@@
base directory: ${BASEDIR}/
notes archive: ${NOTESDIR}/
notes database: ${DB}
rc file: $RCFILE
notes archive: ${NOTESDIR}/
notes database: ${DB}
rc file: $RCFILE
+
text editor: ${EDITOR}
terminal: ${TERMINAL}
jq executable: ${JQ}
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 ""
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 <title> : Add new note"
echo " -m | --modify <note> : Modify note"
echo " -l | --list : List existing notes"
echo " -a | --add <title> : Add new note"
echo " -m | --modify <note> : Modify note"
@@
-98,6
+101,7
@@
function addnote() {
function listnotes() {
echo "listing all notes"
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
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.
# NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install this
# separately; see below.
-GOPT=`getopt -o hv
la:m:d:r: --long help,version,list
,userconf,add:,modify:,date:,remove:,editor:,storage: \
+GOPT=`getopt -o hv
pla: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
-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"
# Note the quotes around `$GOPT': they are essential!
eval set -- "$GOPT"
+PLAIN=false
+
while true; do
case "$1" in
-h | --help )
while true; do
case "$1" in
-h | --help )
@@
-215,6
+221,10
@@
while true; do
echo $BASENAME v${VERSION}
exit
;;
echo $BASENAME v${VERSION}
exit
;;
+ -p | --plain )
+ PLAIN=true
+ shift
+ ;;
-l | --list )
listnotes
exit
-l | --list )
listnotes
exit