I've integrated passmenu into my workflow heavily, but a shortcoming I keep running into is that it doesn't support any extensions. So I've written a patch which supports them by specifying an `--action`. I use it now with `passmenu --action otp --type` to get my 2FA codes easily.
Of note: $action is deliberately unquoted so that the action is split on spaces. This way `passmenu --action 'otp show'` will expand when `pass` is run to `pass otp show ...`. --Paul
From 2997434ddbcc95004bca7ce4b88b4560e773f613 Mon Sep 17 00:00:00 2001 From: xPMo <[email protected]> Date: Fri, 8 Jun 2018 09:52:26 -0500 Subject: [PATCH] Support specifying alternate actions Useful for extensions: For example pass-otp: `passmenu [ --type ] --action otp <dmenu_args>`. --- contrib/dmenu/passmenu | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu index 83268bc..3531bf0 100755 --- a/contrib/dmenu/passmenu +++ b/contrib/dmenu/passmenu @@ -3,10 +3,19 @@ shopt -s nullglob globstar typeit=0 -if [[ $1 == "--type" ]]; then - typeit=1 +action="show" +while + case $1 in + "--type") + typeit=1 ;; + "--action"|"-a") + action="$2" + shift ;; + *) + break ;; + esac shift -fi +do :; done prefix=${PASSWORD_STORE_DIR-~/.password-store} password_files=( "$prefix"/**/*.gpg ) @@ -18,8 +27,8 @@ password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@") [[ -n $password ]] || exit if [[ $typeit -eq 0 ]]; then - pass show -c "$password" 2>/dev/null + pass $action -c "$password" 2>/dev/null else - pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | + pass $action "$password" | { IFS= read -r pass; printf %s "$pass"; } | xdotool type --clearmodifiers --file - fi -- 2.17.1
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Password-Store mailing list [email protected] https://lists.zx2c4.com/mailman/listinfo/password-store
