[pass] Proposal: fuzzy search

Kun Zhang arthur.kun at gmail.com
Tue Aug 16 03:28:14 CEST 2016

I will keep updating my code in this pull-request:


On Mon, Aug 15, 2016 at 9:37 AM, mitfree <lists at ampling.com> wrote:

> I use passmenu to solve this same problem, but I'm willing to try and offer
> some constructive criticism.
> > My change is on github (https://github.com/zhangkun83/password-store/
> commit/
> > a0ccc8f0508ff14169b1923e0273a57b8f2597ca).  It works great for me, and
> I would
> > like to merge this feature upstream.  Please let me know if I need to
> make
> > additional changes (e.g., tests and man pages), or implement this in a
> > different way.
> ## Safe Data Manipulation
> line 324: rm -f "$matches_file" "$matches_file_swap"
> Could you use a bash array instead of writing to disk? If the hidden
> file names don't need to leave the running process, I say try to keep it
> within bash (arrays and variables).
> arrayName=(Value1 Value2 Value3 .. ValueN)
> ${arrName[index]}
> ${#arrayName[@]}

I refrained from using variables for the intermediate results because I was
concerned about argument list expanded beyond the command line limit.
Interestingly, it seems internal commands like "echo" has special treatment
and is not subject to such limit :) Arrays isn't more useful than plain
variables, so I use variables instead.

> ## Regular Expression
> line 338: path=$(echo "$matches" | perl -pe 's/\e\[?.*?[\@-~]//g')
> Why not use sed or builtin?
> Who wants to install all of perl to run bash code?

I googled around but didn't find other code that successfully remove ANSI
color codes for me.
So I landed with the first solution that worked. I can look harder though.

> I hope you find this useful.
> --
> At your service,
> mitfree
> https://ampling.com

Best wishes
Kun Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20160815/2b9a1788/attachment.html>

More information about the Password-Store mailing list