| 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 | PAGER: ${PAGER} |
| 31 | __NOWCONF__ |
| 32 | |
| 33 | echo "" |
| 34 | echo "${BASENAME} parameters are:" |
| 35 | echo -e " -h | --help\t\t\t: This help text" |
| 36 | echo -e " -p | --plain\t\t\t: Output is in plain text" |
| 37 | echo -e "\t\t\t\t (without this option the output is formatted)" |
| 38 | echo -e "\t\t\t\t (this option must precede all others)" |
| 39 | echo -e " -l | --list\t\t\t: List existing notes" |
| 40 | echo -e " -a | --add [\"<title>\"]\t: Add new note" |
| 41 | echo -e " -e | --edit [<note>]\t\t: Edit note" |
| 42 | echo -e " -d | --delete [<note> | all] : Delete single note or all notes at once" |
| 43 | echo -e " -s | --show [<note>]\t\t: Display note using your favourite PAGER" |
| 44 | echo -e " -v | --version\t\t: Print version" |
| 45 | echo -e " --userconf\t\t\t: Export User config file" |
| 46 | echo -e " --backup [<dest>]\t\t: Backup your data in your destination folder" |
| 47 | echo "" |
| 48 | } |
| 49 | |