Hi! I use intensively pass, which is a clever solution to password management. However I miss a feature, which allow me to quickly get password information when I know the pass file, but forgot (or don't want to remember) its position in the password tree.
Thus, I propose the attached patch, which add an option to the "show" command in order to display the content of the first file matching the path parameter. Sort of "I'm lucky" thing for my password bucket. Do not hesitate to discuss my proposal. Maybe you prefer a separate command or something else. As I do not succeed to have git send-email working on my machine (seems to be perl-tls-something related. Not so much time to investigate), I send the result of the git format-patch command instead. If I don't misunderstood git send-email man page, it must be the same thing. Best regards,
>From 687bc0212055ee7370f761ecb2e1914853c1d304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Deparis?= <[email protected]> Date: Mon, 2 Feb 2015 17:30:03 +0100 Subject: [PATCH] Add a new parameter to the show command The new 'fuzzy' parameter allow to search any password file by name, without taking into account its real position in file tree. Very useful to quickly retrieve password from complex password library. --- src/password-store.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/password-store.sh b/src/password-store.sh index 6313384..4916bd6 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -223,7 +223,7 @@ cmd_usage() { List passwords. $PROGRAM find pass-names... List passwords that match pass-names. - $PROGRAM [show] [--clip,-c] pass-name + $PROGRAM [show] [--clip,-c] [--fuzzy,-f] 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. $PROGRAM grep search-string @@ -294,18 +294,25 @@ cmd_init() { } cmd_show() { - local opts clip=0 - opts="$($GETOPT -o c -l clip -n "$PROGRAM" -- "$@")" + local opts clip=0 fuzzy=0 + opts="$($GETOPT -o cf -l clip,fuzzy -n "$PROGRAM" -- "$@")" local err=$? eval set -- "$opts" while true; do case $1 in -c|--clip) clip=1; shift ;; + -f|--fuzzy) fuzzy=1; shift ;; --) shift; break ;; esac done - [[ $err -ne 0 ]] && die "Usage: $PROGRAM $COMMAND [--clip,-c] [pass-name]" + [[ $err -ne 0 ]] && die "Usage: $PROGRAM $COMMAND [--clip,-c] [--fuzzy,-f] [pass-name]" local path="$1" + if [[ $fuzzy -eq 1 ]] && [[ `expr index $path '/'` -eq 0 ]]; then + local firstitem=`find ~/.password-store/ -type f -iname "*${path}*" | sed -n 1p | sed "s|/home/$USER/.password-store/||"` + if [ -n "$firstitem" ]; then + path=${firstitem:0: -4} + fi + fi local passfile="$PREFIX/$path.gpg" check_sneaky_paths "$path" if [[ -f $passfile ]]; then -- 2.2.2
-- Étienne Deparis http://etienne.depar.is/ twitter: @milouse 06 76 28 00 58
_______________________________________________ Password-Store mailing list [email protected] http://lists.zx2c4.com/mailman/listinfo/password-store
