<div dir="ltr"><font face="arial, helvetica, sans-serif">Hello,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Did you use peco or fzf with your past one-liner (<a href="https://github.com/peco/peco">https://github.com/peco/peco</a>, <a href="https://github.com/junegunn/fzf">https://github.com/junegunn/fzf</a>)? They are very nice filtering tools. For reference, here is my dirty script with peco, <a href="https://github.com/Nobutarou/passpeco">https://github.com/Nobutarou/passpeco</a>. You can find "<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">wc-demo/dir-demo2/0-current" by just typing "wc- demo2 cur"</span></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Regards,</font></div><div><font face="arial, helvetica, sans-serif">Nobuyuki </font></div><div><br></div><div><br>2018年4月5日木曜日、Trey Mitchell<<a href="mailto:treym@wolfram.com" target="_blank">treym@wolfram.com</a>><wbr>さんは書きました:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Due to the nature of our environment it's sometimes necessary to iterate through a bunch of old passwords before finding the one I need.<br>
So I wanted to be able to list more than one password in a directory at a time. I was previously using shell one-liners to accomplish this but finally got around to just adding the functionality. It may not make sense for anyone else, but I figured I'd submit it anyway on the off chance that someone else found it useful.<br>
<br>
Example:<br>
<br>
Given this structure<br>
$ pass wc-demo/<br>
wc-demo/<br>
├── 0-current<br>
├── 1-old<br>
├── dir-demo1<br>
│   ├── 0-current<br>
│   └── 1-old<br>
└── dir-demo2<br>
    ├── 0-current<br>
    └── 1-old<br>
<br>
All of these work:<br>
$ pass wc-demo/*<br>
wc-demo/0-current:<br>
pass1<br>
<br>
wc-demo/1-old:<br>
pass2<br>
<br>
$ pass wc-demo/dir*<br>
wc-demo/dir-demo1<br>
├── 0-current<br>
└── 1-old<br>
wc-demo/dir-demo2<br>
├── 0-current<br>
└── 1-old<br>
<br>
$ pass wc-demo/dir*/*<br>
wc-demo/dir-demo1/0-current:<br>
pass2<br>
<br>
wc-demo/dir-demo1/1-old:<br>
oldpass<br>
<br>
wc-demo/dir-demo2/0-current:<br>
pass#1<br>
<br>
wc-demo/dir-demo2/1-old:<br>
A@|FVz}W=w1A@ZkzXD*2WxA2X<br>
<br>
$ pass wc-demo/dir-demo1/*<br>
wc-demo/dir-demo1/0-current:<br>
pass2<br>
<br>
wc-demo/dir-demo1/1-old:<br>
oldpass<br>
<br>
All existing functionality is preserved.<br>
<br>
Let me know if you want me to revise or clean up the code in any way.<br>
<br>
>From abe2089d0d5e76145fec26953a900d<wbr>a695c52d72 Mon Sep 17 00:00:00 2001<br>
From: Trey Mitchell <<a href="mailto:treym@wolfram.com" target="_blank">treym@wolfram.com</a>><br>
Date: Fri, 30 Mar 2018 19:06:30 -0500<br>
Subject: [PATCH] Added wild-card capability to the show command.<br>
<br>
---<br>
 src/password-store.sh | 71 ++++++++++++++++++++++++++++++<wbr>++++-----------------<br>
 1 file changed, 48 insertions(+), 23 deletions(-)<br>
<br>
diff --git a/src/password-store.sh b/src/password-store.sh<br>
index eac5404..aa69ac0 100755<br>
--- a/src/password-store.sh<br>
+++ b/src/password-store.sh<br>
@@ -358,33 +358,58 @@ cmd_show() {<br>
        [[ $err -ne 0 || ( $qrcode -eq 1 && $clip -eq 1 ) ]] && die "Usage: $PROGRAM $COMMAND [--clip[=line-number],-c[line-<wbr>number]] [--qrcode[=line-number],-q[lin<wbr>e-number]] [pass-name]"<br>
<br>
        local path="$1"<br>
-       local passfile="$PREFIX/$path.gpg"<br>
        check_sneaky_paths "$path"<br>
-       if [[ -f $passfile ]]; then<br>
-               if [[ $clip -eq 0 && $qrcode -eq 0 ]]; then<br>
-                       $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $?<br>
-               else<br>
-                       [[ $selected_line =~ ^[0-9]+$ ]] || die "Clip location '$selected_line' is not a number."<br>
-                       local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +${selected_line} | head -n 1)"<br>
-                       [[ -n $pass ]] || die "There is no password to put on the clipboard at line ${selected_line}."<br>
-                       if [[ $clip -eq 1 ]]; then<br>
-                               clip "$pass" "$path"<br>
-                       elif [[ $qrcode -eq 1 ]]; then<br>
-                               qrcode "$pass" "$path"<br>
+       local passfiles="$PREFIX/$path.gpg"<br>
+       local ARRAY=($passfiles)<br>
+<br>
+       if [[ $clip -eq 1 && ${#ARRAY[@]} -gt 1 ]]; then<br>
+               die "Clip makes no sense in multi record context."<br>
+       fi<br>
+<br>
+       for passfile in $passfiles; do<br>
+               local passpath=${passfile#$PREFIX\/}<br>
+               local passpath=${passpath%\.gpg}<br>
+               local passdir=${passfile%\.gpg}<br>
+               local passdirlong=($(ls -d $passdir 2>/dev/null))<br>
+               local passdirshort=${passdirlong#$PR<wbr>EFIX\/}<br>
+               if [[ -f $passfile ]]; then<br>
+                       if [[ $clip -eq 0 && $qrcode -eq 0 ]]; then<br>
+                               if [ ${#ARRAY[@]} -gt 1 ]; then<br>
+                                       printf "$passpath:\n"<br>
+                                       $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $?<br>
+                                       printf "\n"<br>
+                               else<br>
+                                       $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $?<br>
+                               fi<br>
+                       else<br>
+                               [[ $selected_line =~ ^[0-9]+$ ]] || die "Clip location '$selected_line' is not a number."<br>
+                               local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +${selected_line} | head -n 1)"<br>
+                               [[ -n $pass ]] || die "There is no password to put on the clipboard at line ${selected_line}."<br>
+                               if [[ $clip -eq 1 ]]; then<br>
+                                       clip "$pass" "$path"<br>
+                               elif [[ $qrcode -eq 1 ]]; then<br>
+                                       if [ ${#ARRAY[@]} -gt 1 ]; then<br>
+                                               printf "$passpath:\n"<br>
+                                       fi<br>
+                                       qrcode "$pass" "$passpath"<br>
+                               fi<br>
                        fi<br>
-               fi<br>
-       elif [[ -d $PREFIX/$path ]]; then<br>
-               if [[ -z $path ]]; then<br>
-                       echo "Password Store"<br>
+               elif [[ -d ${passdirlong[0]} ]]; then<br>
+                       if [[ -z $path ]]; then<br>
+                               echo "Password Store"<br>
+                               tree -C -l --noreport "$PREFIX" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors<br>
+                       else<br>
+                               for dir in "${passdirlong[@]}"; do<br>
+                               echo ${dir#$PREFIX\/}<br>
+                               tree -C -l --noreport "$dir" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors<br>
+                               done<br>
+                       fi<br>
+               elif [[ -z $path ]]; then<br>
+                       die "Error: password store is empty. Try \"pass init\"."<br>
                else<br>
-                       echo "${path%\/}"<br>
+                       die "Error: $path is not in the password store."<br>
                fi<br>
-               tree -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors<br>
-       elif [[ -z $path ]]; then<br>
-               die "Error: password store is empty. Try \"pass init\"."<br>
-       else<br>
-               die "Error: $path is not in the password store."<br>
-       fi<br>
+       done<br>
 }<br>
<br>
 cmd_find() {<br>
--<br>
2.14.1<br>
<br>
<br>
<br>
--<br>
Trey Mitchell<br>
Wolfram Research, Inc<br>
Systems Administrator, Dev/Ops<br>
<a dir="ltr" href="tel:217-398-0700" target="_blank">217-398-0700</a><br>
______________________________<wbr>_________________<br>
Password-Store mailing list<br>
<a href="mailto:Password-Store@lists.zx2c4.com" target="_blank">Password-Store@lists.zx2c4.com</a><br>
<a href="https://lists.zx2c4.com/mailman/listinfo/password-store" target="_blank">https://lists.zx2c4.com/mailma<wbr>n/listinfo/password-store</a><br>
</blockquote></div>
</div>