note v1.0 released today!

JasKinasis

Super Moderator
Staff member
Gold Supporter
Joined
Apr 25, 2017
Messages
1,967
Reaction score
2,977
Credits
17,468
Hey all.

After this conversation the other day, I finally got around to cleaning up, documenting and releasing my note-management application.

'note' is a very simple application written in shell-script. It's a personal, pet-project I've been developing and using at home and at work for a number of years. It's licensed under the GNU GPL3 (for code) and the GNU FDL v1.3 (for documentation).

I made it because I use the terminal a lot. I make a lot of notes and I like to keep my notes in a single directory.
One day back in 2013, when trying to pull up some notes whilst working in some remote part of my file-system, I got bored of endlessly typing:
Code:
ls ~/notes
vim ~/notes/nameofnote
And I thought that it would be a lot easier if I had something that would let me type something like
Code:
note nameofnote
And it would just open an existing note, or create a new note in my notes directory. And when I couldn't remember what notes I had - I could pull up a list by just typing:
Code:
note

And that was the birth of note! It was hacked together at home one saturday afternoon in 2013. Eventually its usage became a part of my daily routine. At some point in 2014, I put it into a git repo on my PC where it resided for several years. And then back in the summer of 2017 - I uploaded it to a private repo on notabug.org, with the intention of cleaning it up and releasing it. So here it is!

Features:
- Quickly create, view, list, rename and delete notes
- All notes are saved to a single location
(/home/user/.note/notes/)
- Bash completion - hit tab to autocomplete filenames of notes
- Text to speech - via e-speak - so you can hear your notes read aloud in a dead, robotic, brummie voice - optional
- Few dependencies - As long as you have a terminal that can run bash, a text editor and a pager you're good to go. espeak is entirely optional.
- Configurable: note can be set up to use any terminal based text-editor for creating/editing notes and any pager (e.g. more, less, w3m, lynx, cat) for viewing notes.
Changes can be made by using note's settings script (notesettings), or by manually editing note's config file (/home/user/.note/settings.cfg)
- Back-up your notes: note can back-up your notes and settings to a date-stamped .tar.gz file in your home directory.

Installation instructions:
Full installation and usage instructions are on the web-page, but I'll briefly run through it here too.

From git:
The quickest and easiest way to install (and update) is via git.
Open a terminal and use:
Code:
git clone https://notabug.org/JasKinasis/note.git
cd note
sudo ./install.sh

To update:
Code:
cd note
git pull
sudo ./install.sh

Without git:
You will have to download a .zip or .tar.gz from the website and install from that.
1. Download the source code
Open the web-page in a browser and click on the download icon to download the entire source-tree as a .zip, or .tar.gz.

Or you can download it in a terminal using wget:
Code:
wget https://notabug.org/JasKinasis/note/archive/master.zip
or master.tar.gz, if you'd prefer!

2. Extract the files from the archive
e.g.
Code:
unzip master.zip
or
Code:
tar -xvf master.tar.gz
Or use whatever other tool you'd normally use for decompressing zip/tar.gz archives...

3. Run the installation script:
Code:
cd note
sudo ./install.sh

Updating
If you installed via .zip, or .tar.gz, you will need to repeat the above steps to get and install from a newer version of the archive.

Documentation:
No program would be complete without documentation.
If anything, note probably has an excessive amount of documentation. The installation script installs man pages.
There are also some .md pages (Markdown pages) distributed in the source code archive too.
After installation try:
Code:
man note
man notesettings

Usage:
note - Display a list of all notes
note filename - Open a note called "filename" in the editor - (if the file does not exist it will be created when the file is saved)
note -ls - list notes by size
note -la - list notes alphabetically
note -v filename - view a note in the pager
note -d file1 file2 ... delete one or more notes
note -r oldfile newfile - rename a note
note -R filename - read file aloud via espeak
note --backup - backup all notes and settings to a file in the users home directory
note -h - display help/usage information

All notes are saved to /home/user/.note/notes/

As mentioned before, 'note' is a silly little application that I created for my own use at work and at home. It's not a revolutionary piece of software - it doesn't do anything complex or amazing. But it's been extremely handy. I use it almost every day. I've been meaning to release it for a while... well, here it finally is!

BTW: If you want to know why the TTS functionality reads the text in a broad brummie (West Midlands, UK) accent - have a read through README.md - XD
 
Last edited:


Sounds nice! Will try to check it out this weekend when I finally get a break from work.

Cheers
 
Hi Jas, the git clone part works fine for me but when I get to running the install script, I get

Code:
SylviaMATE-Study note # ./install.sh
cp: cannot stat './src/{note,notesettings}': No such file or directory
cp: target '/usr/local/man/man1/' is not a directory

That's the same whether running via sudo or as Root.

I might be holding my mouth the wrong way.

I'll try it fresh tomorrow.

Ta for sharing ;)

Wiz
 
Hi Jas, the git clone part works fine for me but when I get to running the install script, I get

Code:
SylviaMATE-Study note # ./install.sh
cp: cannot stat './src/{note,notesettings}': No such file or directory
cp: target '/usr/local/man/man1/' is not a directory

That's the same whether running via sudo or as Root.

I might be holding my mouth the wrong way.

I'll try it fresh tomorrow.

Ta for sharing ;)

Wiz

Hmmm...... Very odd.
The installer has worked for me on Debian and on Cygwin on Windows. I admit, I haven't tested it on any other distros.

The first error:
Code:
cp: cannot stat './src/{note,notesettings}': No such file or directory
That is extremely perplexing.
It says that it cannot find the file, but {note,notesettings} isn't a single file, it's a regex for the two files to copy.
The cp command should be able to handle that....Hmm...
In that case I'll update the installer and explicitly specify the two files separately.....

The second error:
Code:
cp: target '/usr/local/man/man1/' is not a directory
Indicates that /usr/local/man/man1/ does not exist on your machine....

I've just taken a look on my laptop and my work PC and it appears that /usr/local/man is actually a symbolic link to /usr/local/share/man/.

So I'm guessing that Mint doesn't have that symbolic link set-up. If that is the case, then there are probably other distros that will experience this problem too. So it looks like my systems are the odd ones out - I will change the destination for the man pages to /usr/local/share/man/man1/
 
Last edited:
@wizardfromoz :
OK, I've just made some changes to install.sh and pushed them to the main repo.

Navigate into the note/ directory and try updating and re-installing:
Code:
git pull
sudo ./install.sh

Hopefully that will completely fix the problem.
Thanks for reporting it BTW!
 
Last edited:
Another update:
Over lunch, I've just quickly added some basic search functionality. Something I've been meaning to add for a little while.

So now you can also search for notes containing a particular word/pattern.
e.g.
Code:
note -s Foo
Will perform a case-insensitive search for any notes that contain the word "Foo"

Because it is a case insensitive search - it will match "Foo", "foo", or "FOO" or "fOo" etc. etc.
It's not an exact word search either, so it will also list files containing partial matches.. e.g. words like "foobar", or "food", or "foot", or any mixed case versions of them.

Code:
note -S Foo
Will perform a case-sensitive search and list any notes that contain the word "Foo".
It will still list files containing partial matches like "Food", or "Foobar", but NOT things like "food" or "FOOD" etc.

You can also use regexes.
So, to perform a case-sensitive search to find and list any notes containing lines which start with the word "Foo":
Code:
note -S ^Foo

I don't know about anybody else, but when I've forgotten the name of one of my notes, I'm usually only interested in finding notes that contain a particular key word or phrase.
So for now, the search functionality only accepts a single pattern as a parameter. You can feed it extra ones - it will just ignore them!

If you want to search for a phrase, you can enclose your search inside double quotes.
e.g.
Code:
note -S "Delete this"

At some point I might get around to allowing a search for multiple patterns, but I don't have any need for that at the moment.

The most recent changes have just been pushed to the master repo on notabug.

A quick "git pull" and "sudo ./install.sh" will bring those changes down for you!
 
Navigate into the note/ directory and try updating and re-installing:

From two errors down to one, as follows:

chris@SylviaMATE-Study ~ $ cd note
chris@SylviaMATE-Study ~/note $ ls
completion fdl.md gpl.md INSTALL.md install.sh README.md src
chris@SylviaMATE-Study ~/note $ git pull
remote: Counting objects: 20, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 20 (delta 13), reused 0 (delta 0)
Unpacking objects: 100% (20/20), done.
From https://notabug.org/JasKinasis/note
6cbfd5f..daeab40 master -> origin/master
Updating 6cbfd5f..daeab40
Fast-forward
.gitignore | 1 +
README.md | 3 +++
install.sh | 4 ++--
src/note | 22 +++++++++++++++++++++-
src/note.1 | 8 ++++++++
5 files changed, 35 insertions(+), 3 deletions(-)
chris@SylviaMATE-Study ~/note $ sudo ./install.sh
[sudo] password for chris:
cp: target '/usr/local/share/man/man1/' is not a directory
chris@SylviaMATE-Study ~/note $

Thanks for putting in the effort, I'm having a ball :D

Wiz
 
Dag-nammit..... I thought I had it sussed out!
Sorry @wizardfromoz !

Man is such an old application, you would have thought that all distros would have a standardised system to deal with where to place the man files....

OK, looks like I'll have to update install.sh to do some probing to work out the best place to put the man files....
But first - can I pester you for some information?

Can you tell me the path to manpath.config on your machine wiz?

The output of the following should do the trick:
Code:
locate manpath.config

On my PC, it's located at /etc/manpath.config - which seems to be the default for many distros.
However, from looking online briefly - it appears that some distros don't necessarily put it there either..... Oh for the sake of fudge! XD
Hopefully yours will be /etc/manpath.config too!

Anyway - once you've tracked down the location of manpath.config, can you also post the output from the following command?:
Code:
 cat /path/to/manpath.config | \grep _MAP | \grep /usr/local/bin/
Where /path/to/manpath.config is the path to your manpath.config.

NOTE: Don't forget the backslashes before grep - that way any grep aliases you might have set up will be escaped and I'll just see the raw grep output, with no line numbers, file-names etc.

The output of the above command should show us the mappings for where the man pages should go for executables in /usr/local/bin/.

On my machine I get this:
Code:
MANPATH_MAP     /usr/local/bin          /usr/local/man
MANPATH_MAP     /usr/local/bin          /usr/local/share/man

If I can see how your system differs from mine - perhaps I can work out a way of programmatically determining where to place the man pages.

Who would have thought something so simple would prove to be such a PITA?! :/
At least you have the application working now!
 
Last edited:
Jas - hi. I'm doing a little brainstorming here, or thinking out loud as I go, so if this seems higgledy-piggledy, regrets, but I know you can use the input.

I'll be answering your questions as a separate post, imminently - you will be getting up & having your cornflakes soon :p

NOTE 1

git was already installed on my Linux Mint 18.3 'Sylvia' MATE where I had the errors, but I am currently in Debian 'Stretch' and it is not , remedied with

Code:
sudo apt-get -y install git

... so if you have not already, you might want to let the users know to install git first.

Unfortunately, even on Debian I am getting problems, output is in the Spoiler, and I have separated between the commands for easier viewing.

chris@debian9dot1Cinn:~$ git clone https://notabug.org/JasKinasis/note.git
bash: git: command not found


chris@debian9dot1Cinn:~$ sudo apt-get -y install git
[sudo] password for chris:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
git-man liberror-perl
Suggested packages:
git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk
gitweb git-arch git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 5,619 kB of archives.
After this operation, 31.0 MB of additional disk space will be used.
Get:1 http://mirror.aarnet.edu.au/debian stable/main amd64 liberror-perl all 0.17024-1 [26.9 kB]
Get:2 http://mirror.aarnet.edu.au/debian stable/main amd64 git-man all 1:2.11.0-3+deb9u2 [1,432 kB]
Get:3 http://mirror.aarnet.edu.au/debian stable/main amd64 git amd64 1:2.11.0-3+deb9u2 [4,160 kB]
Fetched 5,619 kB in 5s (1,012 kB/s)
Selecting previously unselected package liberror-perl.
(Reading database ... 219535 files and directories currently installed.)
Preparing to unpack .../liberror-perl_0.17024-1_all.deb ...
Unpacking liberror-perl (0.17024-1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.11.0-3+deb9u2_all.deb ...
Unpacking git-man (1:2.11.0-3+deb9u2) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.11.0-3+deb9u2_amd64.deb ...
Unpacking git (1:2.11.0-3+deb9u2) ...
Setting up git-man (1:2.11.0-3+deb9u2) ...
Setting up liberror-perl (0.17024-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up git (1:2.11.0-3+deb9u2) ...


chris@debian9dot1Cinn:~$ git clone https://notabug.org/JasKinasis/note.git
Cloning into 'note'...
remote: Counting objects: 174, done.
remote: Compressing objects: 100% (162/162), done.
remote: Total 174 (delta 86), reused 0 (delta 0)
Receiving objects: 100% (174/174), 62.20 KiB | 0 bytes/s, done.
Resolving deltas: 100% (86/86), done.


chris@debian9dot1Cinn:~$ cd note


chris@debian9dot1Cinn:~/note$ git pull
Already up-to-date.


chris@debian9dot1Cinn:~/note$ sudo ./install.sh
cp: target '/usr/local/share/man/man1/' is not a directory


chris@debian9dot1Cinn:~/note$ git pull
Already up-to-date.


chris@debian9dot1Cinn:~/note$ sudo ./install.sh
cp: target '/usr/local/share/man/man1/' is not a directory
chris@debian9dot1Cinn:~/note$

I'll swing into LMM and get you the answers to those questions.

Cheers

Wiz
 
Jas re #11, your questions:

chris@SylviaMATE-Study ~ $ locate manpath.config
/etc/manpath.config
/usr/share/doc/man-db/examples/manpath.config.gz
chris@SylviaMATE-Study ~ $

next

chris@SylviaMATE-Study ~ $ cat /path/to/manpath.config | \grep _MAP | \grep /usr/local/bin/
cat: /path/to/manpath.config: No such file or directory

Separate post coming up, for clarity in referring.

Wiz
 
Back again.

On my Toshiba Satellite I am writing this from, I have 29 Distros installed (30 when I install Korora in a few minutes).

The Acer has 40 but is currently out of commission, temporarily, I hope :D

Toshi's stable includes the following in table (formatting will look sloppy)

DISTRO DE


Linux Mint 18.3 Sylvia (18.3) on /dev/sda1 MATE

Linux Mint 18.2 Sonya (18.2) on /dev/sda10 Cinn

Zorin OS 12.2 (12) on /dev/sda11 GNOME

Ubuntu 16.04.3 LTS (16.04) on /dev/sda12 Unity

Pearl Linux 6.0 (artful) (6.0) on /dev/sda13 MATE

Gecko Tumbleweed on /dev/sda14 – based on OpenSUSE Cinn

MX-16.1 Metamorphosis (16.1) on /dev/sda15 - Debian-based Xfce

Peppermint 8 Eight (8) on /dev/sda16 Peppermint

Sabayon/Linux on /dev/sda17 – based on Gentoo MATE

Manjaro Linux (17.1.6) on /dev/sda18 GNOME-Classic

Linux Lite 3.8 (16.04) on /dev/sda19 Xfce

Vinux 5.1 LTS (14.04) on /dev/sda20 GNOME-MATE-Unity

Fedora 27 (Workstation Edition) on /dev/sda21 GNOME

Ubuntu 17.10 (17.10) on /dev/sda22 MATE

Peach OSI The Works 16.04.4 LTS (16.04) on /dev/sda23 Xfce

MX 17 Horizon (17) on /dev/sda24 - Debian-based Xfce

SwagArch on /dev/sda25 Xfce

Linux Mint 18.3 Sylvia (18.3) on /dev/sda26 Cinn

Ubuntu 17.10 (17.10) on /dev/sda27 GNOME

Freespire 3.0.1 (16.04) on /dev/sda28 Xfce

Netrunner 17.10 (17.10) on /dev/sda29 – Debian-based KDE Plasma

Netrunner Rolling (2018.01) on /dev/sda30 – Arch-based KDE Plasma

Sonar (16.07) on /dev/sda33 – based on Manjaro MATE

Linux Mint 18.3 Sylvia (18.3) on /dev/sda4 Xfce

Maui (2.1) on /dev/sda5 KDE Plasma

Mageia 6 (6) on /dev/sda6 GNOME

Kali GNU/Linux Rolling (kali-rolling) on /dev/sda7 GNOME

Linux Mint 18.1 Serena (18.1) on /dev/sda8 Cinn

Debian 9 (Stretch) on /dev/sda9 Cinn


... so in amongst those, are any number we can try it on. In particular, ones I call Direct Debian (based) include besides obviously Debian -

  • MX-16 and MX-17
  • Netrunner 17.10
  • Kali
So I might focus on those for now, as they reflect the Debian environment most closely, but I am also on call for you if you need to check any of the other families, eg RPM-based, Gentoo-based, and Arch-based.

Cheers

Wiz
 
Sorry Wiz, I probably wasn't very clear with my instructions in my previous post.
In the 2nd command, "/path/to/manpath.config" was supposed to be replaced with the path that was output by the previous command.
I.e.
The output from your initial locate command was: /etc/manpath.config

So - replacing /path/to/manpath.config - the second command should be:
Code:
cat /etc/manpath.config | \grep _MAP | \grep /usr/local/bin/

Sorry for any confusion that caused! :/

At least Mint keeps the config in the same place as Debian. That's a relief!
With any luck - seeing the content from manpath.config in the above command will give me some clue.

I think I have an inkling of what the problem might be.
It might be that no other packages installed in /usr/local/bin have installed man pages to the expected location and the directory simply doesn't exist on any of your installed distros yet.
So my installer might just need to create the directories for the man-pages if they do not already exist.

If your output from the second command matches my output - that would confirm my suspicions. So perhaps my only error was assuming that the destination would already exist.

Thanks again for reporting these bugs/problems!

[EDIT]
I'm about to head out to catch the bus for work now, so I'll temporarily be switching to my phone
[/EDIT]
 
Last edited:
I can't believe I did that, I was only on my 2nd beer :oops:. But I did.

At least I was right in one thing - I knew you would check your mail over your Rice Crispies, porridge maybe this time of year, etc, lol.

Have a good working day :p

Meantime, correct output is

chris@SylviaMATE-Study ~ $ cat /etc/manpath.config | \grep _MAP | \grep /usr/local/bin/
chris@SylviaMATE-Study ~ $

ie, nil.

I think I have an inkling of what the problem might be.
It might be that no other packages installed in /usr/local/bin have installed man pages to the expected location and the directory simply doesn't exist on any of your installed distros yet.

Sorry, my Aspie (Asperger's Syndrome) can be a PITA sometimes.

If by that you mean I might not have a /usr/local/bin - I do, and it is populated all the time, across every Distro, because I use it for my own custom scripts.

BUT - if you mean whether I have /usr/local/bin's populated by default when I install a Distro, then the answer is broadly, sometimes yes, sometimes no, depends on the Distro and the Family.

I could classify them if you can use the info?

Did you need a picture?

Cheers

Wiz
 
Meantime, correct output is

chris@SylviaMATE-Study ~ $ cat /etc/manpath.config | \grep _MAP | \grep /usr/local/bin/
chris@SylviaMATE-Study ~ $

ie, nil.

Ah..... OK, so that means that Mint does not map any man-path for programs in /usr/local/bin.
So they are doing something differently.

In that case, please could you post the entire content of /etc/manpath.conf in a spoiler tag? so I can see how Mint are configuring man?

Or perhaps just the output from the command:
Code:
manpath

That might be easier than posting the entire content of manpath.conf. and should tell me which paths that man searches for pages in.


Sorry, my Aspie (Asperger's Syndrome) can be a PITA sometimes.

If by that you mean I might not have a /usr/local/bin - I do, and it is populated all the time, across every Distro, because I use it for my own custom scripts.

BUT - if you mean whether I have /usr/local/bin's populated by default when I install a Distro, then the answer is broadly, sometimes yes, sometimes no, depends on the Distro and the Family.

No, I was thinking that perhaps none of the programs that were installed in your /usr/local/bin had installed any man pages and therefore that the directories in /usr/local/share/man/ just hadn't been created yet.

But from your output from manpath.conf - i.e. nothing, zip, nada - It would appear that Mint does not set up mappings for /usr/local/bin/. Which might explain why the directories don't exist.

So I would be interested to see what manpath and/or manpath.conf does contain. Perhaps Mint uses a single directory for all man-pages or something? Very odd.

Looks like I've got a bit of research to get on with. Who would have thought that writing a bit of script to install two man pages would be such a pain?!

I could just force-create the directories and then copy the man pages there. But because there is no mapping in manpath.conf - you probably wouldn't be able to view the man-pages, because man wouldn't look there for them.... Even though AFAIK, it is where man would traditionally look for pages.

I could classify them if you can use the info?

Did you need a picture?

I honestly don't know what I need right now! XD
 
Hmmm, I've had a quick play with my debian system and the environment variable $MANPATH is never set.

Which is good, because from reading the man page for manpath - if $MANPATH is set - the manpath executable will only use those paths and nothing else.

Without $MANPATH, the manpath executable seems to be able to detect different directories.

The standard output for manpath for my machine yields:
Code:
/usr/local/man:/usr/local/share/man:/usr/share/man

If I rename /usr/local/share/man/ to /usr/local/share/moon (which also invalidates the /usr/local/man symbolic link) and then run manpath it only shows:
Code:
/usr/share/man/

If I restore /usr/local/share/man (which fixes the /usr/local/man link) and run manpath I see:
Code:
/usr/local/man:/usr/local/share/man:/usr/share/man

If I add a man directory to my home folder and run manpath - I get:
Code:
/home/jason/man:/usr/local/man:/usr/local/share/man:/usr/share/man

I couldn't find anything in the configuration for manpath which sets up anything for my home directory - so perhaps manpath has a set of different paths that it looks for - and if they exist - it will just use them.

I tried creating a dummy.1 man file and stuck it in ~/man/man1/ and then ran "man dummy" and it brought up the man page.

If that's the case - that would also give me the green-light to just force create /usr/local/share/man/man1/.

I think I need to pop out and invest in a new USB stick at some point. Then I can try slapping a few different distros on it and have a play with manpath and see what happens if I force-create the path and copy some man pages to it.
 
I'm following ... just :confused:

Output

chris@SylviaMATE-Study ~ $ manpath
/usr/local/man:/usr/local/share/man:/usr/share/man
chris@SylviaMATE-Study ~ $

...so the same as your Debian.

Sing out if you need more, mate

Chris
 
Aha!
Now we're getting somewhere.
That means that /usr/local/share/man/ exists on your system.

So my initial hunch was correct.
No other programs have installed any documentation to /usr/local/share/man/man1

So the man1 subdirectory doesn't exist yet. Which is why you were getting that error.

So my installation script will need to create the directory for the man pages if it doesn't already exist.

Phew!
I'll post again later when I've made and uploaded the changes.
Hopefully that will put this issue to bed.

At some point in the next couple of days, I'll be adding an uninstall script. Would be rude not to!
 

Staff online


Latest posts

Top