Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplenotes fzf integration #110

Open
drewauff opened this issue Jul 14, 2021 · 5 comments
Open

Simplenotes fzf integration #110

drewauff opened this issue Jul 14, 2021 · 5 comments
Labels

Comments

@drewauff
Copy link

drewauff commented Jul 14, 2021

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.

@samuelallan72
Copy link

samuelallan72 commented Jul 14, 2021

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

@drewauff
Copy link
Author

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.

@samuelallan72
Copy link

@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.

@drewauff
Copy link
Author

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants