<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>On Wed, Apr 19, 2017 at 12:59 PM, David A. <span dir="ltr"><<a href="mailto:listmail@cox.net" target="_blank">listmail@cox.net</a>></span> wrote:<br></div></div></div></div></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, 19 Apr 2017 11:26:33 -0500, Milo Gertjejansen<br>
<<a href="mailto:milo@milogert.com">milo@milogert.com</a>> wrote:<br>
<br>
>Hey all,<br>
><br>
>First time posting here. I am hoping to contribute a small patch to the<br>
>"find" command to prompt the user for options if there is only one result<br>
>found.<br>
><br>
>I have been using pass for around two months and the only thing I found<br>
>annoying was when I searched for "steampowered" it would tell me exactly<br>
>where it lived but it wouldn't do anything with it by default.<br>
<br>
</span>My personal opinion is that pass does it correctly right now.  It<br>
shouldn't behave differently based on the number of entries found.<br>
Randomly interjecting an interactive dialog to a command that is<br>
intended to produce stdout could introduce lots of problems.  This<br>
kind of thing is easily done with a custom script or maybe a plugin.<br>
<br>
On a more technical level, I see a couple issues with your<br>
implementation...<br>
<br>
Your option to show the username adds an assumption to the data<br>
structure that doesn't exist in pass today, and in fact is documented<br>
on the web page as explicitly not existing.  Your code would be the<br>
only place in pass where that assumption is made.<br>
<br>
Likewise the "extra" option that just drops the first line of output<br>
seems very arbitrary.<br>
<br>
Additionally, you weren't careful to initialize the optional<br>
variables.  The "args", "username", and "extra" variables affect the<br>
execution of the code and yet they're only conditionally set.  You<br>
should initialize those variables before the case statement so the<br>
subsequent code will always be accurate.<br>
<br>
</blockquote></div><br></div><div class="gmail_extra">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.</div><div class="gmail_extra"><br></div><div class="gmail_extra">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 "rambling."</div><div class="gmail_extra"><br></div><div class="gmail_extra">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?</div><div class="gmail_extra"><br></div><div class="gmail_extra">Finally, the variable changes are easy enough to fix and that's certainly something I will do.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks again for the feedback though.</div></div>