[PATCH] a single result from find prompts the user

David A. listmail at cox.net
Wed Apr 19 19:59:39 CEST 2017

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

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.

More information about the Password-Store mailing list