a8f0981310ecc36a6889e517eecad098a43600d8
[bash-notes.git] / SOURCE / CORE / helpers.sh
1 # check if input is a number, returns false or the number itself
2 function check_noteID() {
3 IN=$1
4 case $IN in
5 ''|*[!0-9]*)
6 return 1
7 ;;
8 *)
9 echo "$IN"
10 ;;
11 esac
12 }
13
14 function helptext() {
15 echo "Usage:"
16 echo " $0 [PARAMS] ..."
17 echo ""
18 cat << __NOWCONF__
19 ${BASENAME} configuration is:
20
21 base directory: ${BASEDIR}/
22 notes archive: ${NOTESDIR}/
23 notes database: ${DB}
24 rc file: $RCFILE
25 debug file: /tmp/debug_bash-note.log
26
27 text editor: ${EDITOR}
28 terminal: ${TERMINAL}
29 jq executable: ${JQ}
30 __NOWCONF__
31
32 echo ""
33 echo "${BASENAME} parameters are:"
34 echo " -h | --help : This help text"
35 echo " -p | --plain : Output is in plain text"
36 echo " (without this option the output is formatted)"
37 echo " (this option must precede all others)"
38 echo " -l | --list : List existing notes"
39 echo " -a | --add [\"<title>\"] : Add new note"
40 echo " -e | --edit [<note>] : Edit note"
41 echo " -d | --delete [<note> | all] : Delete single note or all notes at once"
42 echo " -s | --show [<note>] : Display note using your favourite PAGER"
43 echo " -v | --version : Print version"
44 echo " --userconf : Export User config file"
45 echo ""
46 }