xmonad / xmonad-contrib

Contributed modules for xmonad

Home Page:https://xmonad.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XMonad.Prompt.Pass: Missing generic search feature

Maeda1 opened this issue · comments

commented

Problem Description

This is more a feature request than a problem.

Current problem: when opening the prompt in XMonad.Prompt.Pass, one must type the very first characters of an existing first level folder in $HOME/.password-store to show/match entries.

Pass utility has the find argument that can search based on a keyword and match any folder or any GPG file that contains the keyword, which is much more easier to find a password entry.

Steps to Reproduce

Assuming you have this $HOME/.password-store example entries:
$HOME/.password-store/www/github/email.gpg
$HOME/.password-store/www/github/password.gpg
$HOME/.password-store/other/mybestwebsite/password.gpg

Using XMonad.Prompt.Pass:

  • Type the keybinding to show up the Xmonad pass prompt
  • Type a keyword for example password
  • It will not find anything, except if you type www or other

Using pass:

  • Type pass find password, then ENTER
  • It will find below entries:
    -> $HOME/.password-store/www/github/password.gpg
    -> $HOME/.password-store/other/mybestwebsite/password.gpg
    And without knowing the first full path folders.

That is a much better behavior and expected to have the same when using XMonad.Prompt.Pass

Checklist

  • I've read CONTRIBUTING.md

  • I tested my configuration

    • With xmonad version 0.17.0-20
    • With xmonad-contrib version 0.17.0-20

What you're probably looking for is X.P.FuzzyMatch, which implements a fuzzy search for the prompt

Only if you can integrate it with pass(1) somehow. I suspect that's what the find subcommand to it does.

commented

fuzzyMatch is indeed very close to what pass find does, except that it matches others too:

Example: "spr" matches FastSPR but also SuccinctParallelTrees because it's a subsequence of the latter: "S.......P.r..........".

Because of fuzzySort good relevance sorting (e.g., making "spr" matches first), I am adopting fuzzyMatch as a good solution.

Besides, that should be included by default for Prompt.pass, or highly recommended in the Prompt.pass documentation.

Besides, that should be included by default for Prompt.pass, or highly recommended in the Prompt.pass documentation.

You're probably right; I can't imagine people wanting to type out the whole path to their password every time. We should probably document this default though, in case users do want that. Fancy opening a PR?

commented

You mean pull request by changing $usage in Pass.hs to add a note about that?

I mean changing mkPassPrompt to automatically apply the fuzzy matcher and sorter, as well as document this in the module so that users who do not wish to use these features (or use other search predicates and sorters) know to turn them off.

(This would of course break backwards compatibility, but I think it's a worthwhile trade off to having yet another mkPassPrompt')

commented

I am afraid that is out of my skills 😞

No worries, I'll (try to, time permitting) prepare something tomorrow then