[PATCH] a single result from find prompts the user

Milo Gertjejansen milo at milogert.com
Wed Apr 19 20:09:38 CEST 2017

On Wed, Apr 19, 2017 at 12:59 PM, David A. <listmail at cox.net> wrote:

> On Wed, 19 Apr 2017 11:26:33 -0500, Milo Gertjejansen
> <milo at milogert.com> wrote:
> >Hey all,
> >
> >First time posting here. I am hoping to contribute a small patch to the
> >"find" command to prompt the user for options if there is only one result
> >found.
> >
> >I have been using pass for around two months and the only thing I found
> >annoying was when I searched for "steampowered" it would tell me exactly
> >where it lived but it wouldn't do anything with it by default.
> My personal opinion is that pass does it correctly right now.  It
> shouldn't behave differently based on the number of entries found.
> Randomly interjecting an interactive dialog to a command that is
> intended to produce stdout could introduce lots of problems.  This
> kind of thing is easily done with a custom script or maybe a plugin.
> On a more technical level, I see a couple issues with your
> implementation...
> Your option to show the username adds an assumption to the data
> structure that doesn't exist in pass today, and in fact is documented
> on the web page as explicitly not existing.  Your code would be the
> only place in pass where that assumption is made.
> Likewise the "extra" option that just drops the first line of output
> seems very arbitrary.
> Additionally, you weren't careful to initialize the optional
> variables.  The "args", "username", and "extra" variables affect the
> execution of the code and yet they're only conditionally set.  You
> should initialize those variables before the case statement so the
> subsequent code will always be accurate.
Thanks for the feedback. I could try my hand at a plugin instead of a core
change if this ends up not making it into pass proper.

I see your point about the structure. Even some of my entries are not
structured like that. My main gripe was that it didn't just copy the
password for me so any changes beyond clipping the password was probably me

Would the patch be more in line with the rest of pass if find accepted a
"-c" argument to clip the password if there is only one result? Then the
user would have to do something that they would be familiar with to make
find act differently. Or even provide a list of files to choose to clip
from if many were matched?

Finally, the variable changes are easy enough to fix and that's certainly
something I will do.

Thanks again for the feedback though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20170419/7641504f/attachment.html>

More information about the Password-Store mailing list