working on the backup and backup restore functionalities.
[bash-notes.git] / SOURCE / CORE / helpers.sh
CommitLineData
fb711183 1# check if input is a number, returns false or the number itself
2function 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
14function helptext() {
15 echo "Usage:"
16 echo " $0 [PARAMS] ..."
17 echo ""
18 cat << __NOWCONF__
19${BASENAME} configuration is:
20
21base directory: ${BASEDIR}/
22notes archive: ${NOTESDIR}/
23notes database: ${DB}
24rc file: $RCFILE
25debug file: /tmp/debug_bash-note.log
26
27text editor: ${EDITOR}
28terminal: ${TERMINAL}
29jq executable: ${JQ}
9eb02251 30PAGER: ${PAGER}
fb711183 31__NOWCONF__
32
33 echo ""
34 echo "${BASENAME} parameters are:"
9eb02251 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"
fb711183 47 echo ""
48}
9eb02251 49