-function addnote() {
+addnote() {
# remove eventually existing temp DB file
if [[ -f $TMPDB ]]; then
rm $TMPDB
-function backup_data() {
+backup_data() {
BACKUPDIR="$1"
echo "backing up data in $BACKUPDIR"
fi
}
-function backup_restore() {
+backup_restore() {
BACKUPDIR="$1"
echo "restoring backup from $BACKUPDIR"
echo "This will overwrite all your notes and configurations with the backup."
-function editnote() {
+editnote() {
NOTE=$1
# shellcheck disable=SC2155
local OK=$(check_noteID "$NOTE")
-function listnotes() {
+listnotes() {
# [ $PLAIN == true ] && echo "output is plain text" || echo "output is colored"
if [[ $(ls -A "$NOTESDIR") ]]; then
if [ $PLAIN == false ]; then
-function rmnote() {
+rmnote() {
# remove eventually existing temp DB file
if [[ -f $TMPDB ]]; then
rm $TMPDB
-function shownote() {
+shownote() {
NOTE=$1
# shellcheck disable=SC2155
# check if input is a number, returns false or the number itself
-function check_noteID() {
+check_noteID() {
IN=$1
case $IN in
''|*[!0-9]*)
esac
}
-function helptext() {
+helptext() {
echo "Usage:"
echo " $0 [PARAMS] [note ID]..."
echo ""
echo -e "if a non option is passed and is a valid note ID, the note will be displayed."
}
-function configtext() {
+configtext() {
cat << __NOWCONF__
${BASENAME} configuration is:
}
# this function returns a random 2 words title
-function random_title() {
+random_title() {
# Constants
X=0
DICT=/usr/share/dict/words
echo $PID > "$PIDFILE"
# Export config to file
-function export_config() {
+export_config() {
if [ -r ${RCFILE} ]; then
echo "Backing up current '${RCFILE}'...."
mv -f ${RCFILE} ${RCFILE}.$(date +%Y%m%d_%H%M)
# we should expand on this function to add a sample note and explain a little bit
# how the program works.
-function firstrun() {
+firstrun() {
[ -f $RCFILE ] && RC=$RCFILE || RC="none"
clear