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

cyberxndr . cyberxndr at gmail.com
Tue May 26 09:04:35 CEST 2015


This code provides a quick way to retrieve one password from the tree. I would
like to know is whether or not it is accepted.

2015-05-13 13:35 GMT+03:00 cyberxndr . <cyberxndr at gmail.com>:

> diff --git a/password-store/src/password-store.sh
> b/password-store-feature/src/password-store.sh
> index 47f7ffa..d5f6a59 100755
> --- a/password-store/src/password-store.sh
> +++ b/password-store-feature/src/password-store.sh
> @@ -223,9 +223,10 @@ cmd_usage() {
>                 List passwords.
>             $PROGRAM find pass-names...
>                 List passwords that match pass-names.
> -           $PROGRAM [show] [--clip,-c] pass-name
> +           $PROGRAM [show] [--clip,-c] [--exclusive,-e] 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.
> +               Optionally, entry can contain * wildcard for quickly
> exclusive passwords.
>             $PROGRAM grep search-string
>                 Search for password files containing search-string when
> decrypted.
>             $PROGRAM insert [--echo,-e | --multiline,-m] [--force,-f]
> pass-name
> @@ -294,12 +295,13 @@ cmd_init() {
>  }
>
>  cmd_show() {
> -       local opts clip=0
> -       opts="$($GETOPT -o c -l clip -n "$PROGRAM" -- "$@")"
> +       local opts clip=0 exclusive=0
> +       opts="$($GETOPT -o ce -l clip,exclusive -n "$PROGRAM" -- "$@")"
>         local err=$?
>         eval set -- "$opts"
>         while true; do case $1 in
>                 -c|--clip) clip=1; shift ;;
> +               -e|--exclusive) exclusive=1; shift;;
>                 --) shift; break ;;
>         esac done
>
> @@ -308,6 +310,13 @@ cmd_show() {
>         local path="$1"
>         local passfile="$PREFIX/$path.gpg"
>         check_sneaky_paths "$path"
> +       if [[ exclusive -eq 1 ]]; then
> +               passfile=`find "$PREFIX" -path *$1*.gpg`
> +               results=`echo $passfile | tr " " "\n" | wc -l`
> +               if [[ $results -ne 1 ]]; then
> +                       die "$results passwords founded (need 1)"
> +               fi
> +       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/20150526/a9495e3c/attachment.html>


More information about the Password-Store mailing list