updated README
authordanix <danix@danix.xyz>
Sat, 25 Mar 2023 18:27:53 +0000 (19:27 +0100)
committerdanix <danix@danix.xyz>
Sat, 25 Mar 2023 18:27:53 +0000 (19:27 +0100)
README.md
notes.sh

index 992e7a8..b2d9f6d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
 # bash notes
 
-### a simple note taking app written in bash
+## a simple note taking script written in bash
 
-I've found myself in need of a simple way to take notes, and since the other solutions available didn't meet my needs, I've decided to write my own app.
+I've found myself in need of a simple way to take notes, and since the other solutions available didn't meet my needs, I've decided to write my own script.
 
 It's a simple (enough) bash script, the only dependance (yet) is [jq](https://stedolan.github.io/jq/).
 
-here's all the functions that I'm planning to implement:
+here's all the functions that are now available:
 
 ```bash
 -h | --help                    : This help text
@@ -19,4 +19,100 @@ here's all the functions that I'm planning to implement:
 --userconf                     : Export User config file
 ```
 
-not all functionalities are present at the moment
\ No newline at end of file
+All the basic functionalities are present and working, it probably needs some polishing and some testing, so if you want to give it a try, let me know what you think.
+
+### Settings
+
+When you first run it, notes.sh will create all the files it needs to operate.
+By default the directory will be populated in `~/.local/share/bash-notes`.
+
+If you want to modify the predefined settings, you can export a user configuration file by running
+
+```notes.sh --userconf```
+
+And you'll have all your settings in `~/.config/bash-notes.rc`. This file will be sourced everytime you run the script.
+
+You can change all these settings:
+
+```Bash
+# Binaries to use
+JQ=/usr/bin/jq
+EDITOR=/usr/bin/vim
+TERMINAL=/usr/bin/alacritty
+# add options for your terminal. Remember to add the last option to execute
+# your editor program, otherwise the script will fail.
+# see example in the addnote function
+TERM_OPTS="--class notes --title notes -e "
+
+# base directory for program files
+BASEDIR=~/.local/share/bash-notes
+# notes database in json format
+DB=${BASEDIR}/db.json
+# directory containing the actual notes
+NOTESDIR=${BASEDIR}/notes
+```
+
+Most are pretty self explanatory, the only one that might need clarification is `TERM_OPTS` which is used to set the terminal window that will run the editor while writing the note.
+
+Special attention is needed when specifying the options, in my case, using [alacritty](https://github.com/alacritty/alacritty), the option that allows to run some software in the newly created window is `-e`, so I need to specify this as the last option.
+
+### Functionalities
+
+bash-notes can:
+ * write a new note `--add "Your note title"` or in short `-a "Your note title"`
+ * modify an existing note `--edit [note ID]`, short version `-e [note ID]`
+ * delete a note `--delete [note ID]`, or `-d [note ID]`
+ * delete all notes `--delete all`, or `-d all`
+ * list existing notes `--list` or `-l` in short
+
+The *note id* is assigned when the note is created, and that's how you refer to the note in the program.
+
+The `--plain` or `-p` option in short, dictates how the output from the script is formatted, here's a sample listing of all the notes:
+
+```
+notes.sh -l
+listing all notes
+
+[ID]    [TITLE]         [CREATED]
+[1]     ciao nota       25/03/2023 18:53 +0100CET
+[2]     hello there     25/03/2023 19:02 +0100CET
+```
+
+And here's the same listing with the plain option:
+
+```
+notes.sh -pl
+1 - ciao nota - 25/03/2023 18:53 +0100CET
+2 - hello there - 25/03/2023 19:02 +0100CET
+```
+
+It's just a proof of concept at the moment, but the idea is to use a more interesting output maybe using markup, and strip it down in plain mode. After all is still a work in progress.
+The plain option must precede all other options or it won't work. I'll try and fix this behaviour in the future.
+
+I'd love to implement some kind of searching functionality, but I'll have to look into that.
+
+### Vision
+
+Ok, maybe vision is a bit of a stretch, but I've written this script to use it in my daily workflow with [rofi](https://github.com/davatorium/rofi) and [i3wm](https://github.com/i3/i3). I'll adapt the way it works to better suit this need of mine.
+
+There are of course things I'd love to add, but my main goal is for it to work the way I planned to use it.
+
+### TO DO
+
+ * add a way to search the notes
+ * add a way to display a note without running vim
+ * markdown?
+       - maybe implement an export feature that builds the html file from the note
+ * other ideas may come [...]
+
+### Contributing
+
+It'd mean so much to receive some feedback, patches if you feel like contributing, I'm not expecting much as this is a personal project, but feel free to interact as much as you want.
+
+### Mantainer
+
+ * [danix](https://danix.xyz) - it's just me, really...
+### LICENSE
+
+> bash-notes © 2023 by danix is licensed under CC BY-NC 4.0. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/
\ No newline at end of file
index 14fa059..eba388f 100644 (file)
--- a/notes.sh
+++ b/notes.sh
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+# bash-notes © 2023 by danix is licensed under CC BY-NC 4.0. 
+# To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/
+
 # set -ex
 
 PID=$$
@@ -98,7 +101,7 @@ __NOWCONF__
     echo "                               (this option must precede all others)"
     echo "  -l | --list                        : List existing notes"
     echo "  -a | --add [\"<title>\"]   : Add new note"
-    echo "  -m | --modify [<note>]     : Modify note"
+    echo "  -e | --edit [<note>]               : Edit note"
     echo "  -d | --delete [<note> | all]       : Delete single note or all notes at once"
     echo "  -v | --version             : Print version"
     echo "  --userconf                 : Export User config file"
@@ -272,7 +275,7 @@ fi
 
 # NOTE: This requires GNU getopt.  On Mac OS X and FreeBSD, you have to install this
 # separately; see below.
-GOPT=`getopt -o hvpla:m:d: --long help,version,list,plain,userconf,add:,modify:,delete:,editor:,storage: \
+GOPT=`getopt -o hvpla:e:d: --long help,version,list,plain,userconf,add:,edit:,delete:,editor:,storage: \
              -n 'bash-notes' -- "$@"`
 
 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
@@ -305,7 +308,7 @@ while true; do
                        shift 2
                        addnote "$TITLE"
                ;;
-               -m | --modify )
+               -e | --edit )
                        NOTE="$2"
                        shift 2
                        editnote "$NOTE"