[pass] [PATCH][FEATURE] password-store.sh: added option for quick password showing

cyberxndr . cyberxndr at gmail.com
Wed May 27 21:49:19 CEST 2015


Here is the patch that provides default wildcards support.

diff --git a/password-store/src/password-store.sh
b/password-store-feature/src/password-store.sh
index 47f7ffa..42d2e1f 100755
--- a/password-store/src/password-store.sh
+++ b/password-store-feature/src/password-store.sh
@@ -226,6 +226,8 @@ cmd_usage() {
            $PROGRAM [show] [--clip,-c] pass-name
                Show existing password and optionally put it on the
clipboard.
                If put on the clipboard, it will be cleared in $CLIP_TIME
seconds.
+               Pass-name can contain wildcards (*) or be a substring.  If
it
+               matches uniquely, operate on that password file.
            $PROGRAM grep search-string
                Search for password files containing search-string when
decrypted.
            $PROGRAM insert [--echo,-e | --multiline,-m] [--force,-f]
pass-name
@@ -308,6 +310,13 @@ cmd_show() {
        local path="$1"
        local passfile="$PREFIX/$path.gpg"
        check_sneaky_paths "$path"
+
+       passfile=`find "$PREFIX" -path *$1*.gpg`
+       results=`echo $passfile | tr " " "\n" | wc -l`
+       if [[ $results -ne 1 && -n "$1" ]]; then
+               die "$results passwords found (need 1)"
+       fi
+
        if [[ -f $passfile ]]; then
                if [[ $clip -eq 0 ]]; then
                        $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20150527/e0ab97d7/attachment.html>


More information about the Password-Store mailing list