Commandline Interface

16 views
Skip to first unread message

Tavis Ormandy

unread,
Feb 20, 2023, 6:29:16 PM2/20/23
to noteca...@googlegroups.com
Hello, I have a bunch of notes I've been keeping in notecase over the
years, but there's no easy way to access them from the commandline.

So, I wrote a quick script to pull them out...is anyone else interested?

It's just a shell script, it kinda grew organically as I needed it.

https://github.com/taviso/ncpro

It looks like this:

$ ncpro help
usage: ncpro [-d database] CMD [PARAMS...]
CMD can be one of:
list - list child notes
print - print note contents
show - alias for print
edit - open editor and change note
find - find notes with matching string
markdown - set all notes without syntax to markdown

(where database is a .ncdb file)

$ ncpro list
• /Linux - 33
• /Windows - 19

And you can drill down into deeper levels:

$ ncpro list /Linux
• /Linux/apt
• /Linux/awk
...

And then print the article you want:

$ ncpro print /Linux/awk
/Linux/awk

Print lines between a pattern

awk '/start/,/end/'

Sort lines by length

awk '{ print length, $0 }' | sort -g

...

You can even edit a note with $EDITOR:

$ ncpro edit /Linux/awk

Will open it in vim.

I haven't managed to break a note yet, but it's pretty hacky, and I'm sure
Miroslav is horrified :)

Tavis.

--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger tav...@sdf.org
_\_V _( ) _( ) @taviso

Miroslav Rajcic

unread,
Feb 21, 2023, 7:08:19 AM2/21/23
to noteca...@googlegroups.com
Hi Tavis,

thanks for sharing this, I'm sure it will help someone who likes using the program from command line interface, just like you.
I've quickly browsed the code, bash code looks clean, nice 🙂

Regards,
  Miroslav


From: noteca...@googlegroups.com <noteca...@googlegroups.com> on behalf of Tavis Ormandy <tav...@gmail.com>
Sent: Tuesday, February 21, 2023 12:29 AM
To: noteca...@googlegroups.com <noteca...@googlegroups.com>
Subject: Commandline Interface
 
--
You received this message because you are subscribed to the Google Groups "Notecase Pro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to notecase-pro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/notecase-pro/Y/QCSag0oy7DUg97%40thinkstation.cmpxchg8b.net.
Reply all
Reply to author
Forward
0 new messages