Shell script to speed up note-taking in terminal

Hello All,
Inspired by the speed and ease of entering tasks using Taskwarrior or todo.txt, I wrote this script to help make Joplin better if you only need to write a quick note. It is not a complete wrapper for joplin cli, it is only (so far) able to add notes with tags, sync and create notebooks (if needed).

You can use the -f option to enter silent mode, so that it does not return anything, I imagine it could be a helpful if you want to send notes to joplin from another program.

It can be found HERE

Hope somebody finds it helpful.

NB: Being my first shell script, it is probably plenty inefficient in terms of coding style, but it seems to get the job done as long as you stay inside of its limits!

5 Likes

Hi!

For a first script this is very well done!

But just because you mentioned ‘inefficient’,
I remembered that if [... 0 ...] uses the program
test (like bourne shell sh does), while you correctly
use bash to have $(...) and arrays. In bash you
have the internal if [[... == ...]] which does not use
the external command.

Yours Stucki

This is a late reply, but I finally thought I might make changes to the script to use the builtin command instead, but in my research, it seems like both actually is builtin to most shells these days, but the “test” and “[” commands needs to be compatible with the old externals for compatibility. I have changed it in my script as it looks like the new “[[” is more robust, besides it gave me a reason to try and commit changes to the github repository!

I also added an export database switch to the code, as I am still not trusting Joplin to not delete all my notes again (although it seems better now that I got Nextcloud sync working instead of local sync.)
Now one can easily use a different joplin profile, by uncommenting and commenting at the top of the script to use the desktop profile for instance. If used, it also checks to see if the desktop app is running before submitting the new note to prevent corrupting the database.

Another thing I was thinking of in regards to the script: should the tags people enter with the “+”-prefix be left in the note instead of removing them from the text as it currently does? The idea was that one could add them anywhere in the command, but if one uses them as words in the note body it might make sense to keep them in the text? Not sure how to implement this… remove tags entered before the title, but keep the ones entered after as part of the note body? I am currently not a big user of tags, so I am just trying to imagine use cases…

@pynting Did you use this script for taskwarrior now ?

I am not sure exactly what you mean?
It is a script that interfaces with joplin-cli, not taskwarrior...
I have not used the script in a long time, and it should be considered no longer maintained.

Okay thanks, that answers my question.