sncli icon indicating copy to clipboard operation
sncli copied to clipboard

Simplenotes fzf integration

Open drewauff opened this issue 4 years ago • 5 comments

I am trying to use fzf to bring up a list of preselected notes, (using there keys of course).

I can bring up the list of predetermined name but cannot associate nor select the note via its key which is the important part.

How can I accomplish this?

I should note that I plan to use this as an fzf widget, just tap a hotkey to bring the list select then edit or create a new one.

drewauff avatar Jul 14 '21 05:07 drewauff

@drewauff you can use sncli -k <key> to select a note given its key. Does this help?

samuelallan72 avatar Jul 14 '21 06:07 samuelallan72

not really, my original plan was to use an array..easier said then done. Not only do I need a name for the note but I also need the corresponding key.

As for the command you suggested, I set up an alias for each note/key, would be much easier to select it from a list.

This is how it would work:

  1. Hit shortcut key in terminal (in my case iTerm2) ie. ctrl-s
  2. select from list to edit.

And thats it. The premise is simple, the execution however, is not.

drewauff avatar Jul 14 '21 06:07 drewauff

@drewauff maybe some combination of sncli list and sncli -k? Example:

sncli -k $(sncli list | fzf | cut -f1 -d' ')

Note that all the notes are stored as json files in the cfg_db_path directory (~/.sncli/ by default), so you could potentially write a script to process those files directly if you want a fancy output for fzf, and then pass the id to sncli -k.

samuelallan72 avatar Jul 14 '21 06:07 samuelallan72

That command gives "ERROR: check log for sync errors." error.

It does, however have pontential.

Also in the json files the content of the notes are dumped in a single line..

drewauff avatar Jul 15 '21 03:07 drewauff

Why did you have to make it so edit has to go at the end? makes using sncli outside of the client itself almost impossible. makes no sense.

Trying to parse xargs -I % --key= % impossible because I cant parse "edit" after the key.

I have tried everything I can think of but nothing works.

This is more less what I want to use, this brings up the list of "keys" but only displays the title of the notes.

However, I cant and wont work because "edit" has to go after the key.

sncli -key list | cut -d ' ' -f8- | fzf --tac -s | xargs -I % sncli --key= %

Once I get this working, i just need to adjust it so only the notes I want will be listed.

drewauff avatar Jul 26 '21 07:07 drewauff