dcreemer / 1pass

A caching wrapper for the 1Password CLI
GNU General Public License v3.0
161 stars 28 forks source link

Allow tighter integration with `fzf` #43

Open maricn opened 2 years ago

maricn commented 2 years ago

Would be nice that instead of directly copying passwords with fzf, there was a way to invoke 1pass to display the details (overview) of the login/note/etc in the fzf preview pane.

Rationale

  1. I sometimes have logins/notes/etc. in multiple vaults that have similar or same name, and are for different users.
  2. Currently only thing that can be previewed with 1pass is list of fields available on the item and the associated password (or note content). The latter is dangerous to be displayed due to over-the-sholder eavesdropping, and the former is not very usable if we need to distinguish between users or URLs of the items.
  3. I could use op directly for that, but if 1pass already provides a caching layer, I'd prefer to use it. Also, I like having a single interface authenticating me.
maricn commented 2 years ago

I hacked away a primitive solution that makes it possible to use 1pass and fzf like this

alias fp='1pass | fzf --preview "1pass --pretty {}" --bind "enter:execute(1pass {})"' 

image

Shouldn't be too hard to implement ability to have hotkeys for (1) copying username and (2) copying password, without exiting the fzf dialog. 1pass would only need another command to print username in addition to the jq colored output of the .overview field of the item.

But that's a big change of your API, so let me know if you find that useful, I can refactor and push these days...