dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 071fe70f29c02526ebfb08f7f560388e0509dc5a
parent 8d798d3ef7204f787b804b9558442f422e2e9d1a
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue, 19 May 2020 15:41:25 +0200

Remove pass(1) dependence and remove verbose and version options

Diffstat:
M.local/bin/passmenu | 40++++++++++------------------------------
1 file changed, 10 insertions(+), 30 deletions(-)

diff --git a/.local/bin/passmenu b/.local/bin/passmenu @@ -1,7 +1,5 @@ #!/bin/sh -# requirements: pass(1), dmenu(1), xdotool(1) for -t, -n and -u options - -version=0.1.0 +# requirements: dmenu(1), xdotool(1) (for -t, -n and -u options) pass_dir="$HOME/.password-store" @@ -13,8 +11,6 @@ show_help() echo echo "OPTIONS are one or more of the following:" echo " -h show this message" - echo " -v show version and license information" - echo " -V show verbose information" echo " -t type out the password instead of copying to clipboard" echo " -n type out newline character after password type out (-t)" echo " -u VAL type out VAL before copying password or typing it out" @@ -32,14 +28,6 @@ show_help() echo " ${0##*/} -n -t -u \"myusername\\t\"" } -show_version() -{ - echo "${0##*/} version $version" - echo "licensed under the ISC License" - echo "written by Anders Damsgaard, anders@adamsgaard.dk" - echo "https://src.adamsgaard.dk/dotfiles" -} - die() { printf '%s: error: %s\n' "${0##*/}" "$1" >&2 @@ -78,29 +66,28 @@ match_password_file() retrieve_password() { - _passfile="${1%%.gpg}" - if [ -n "$prefix" ]; then - printf "$prefix" | xdotool type --clearmodifiers --file - - fi - - if [ ! -r "$_passfile" ]; then + if [ "$1" = "clipboard" ] || [ "$1" = "primary" ]; then xdotool type "$(xclip -o -selection "$1")" exit 0 fi + + _passfile="${pass_dir}/${1}.gpg" + if [ -n "$prefix" ]; then + xdotool type "$prefix" + fi + if [ "$typeout" = 1 ]; then - pass show "$_passfile" | \ + gpg -q -d "${_passfile}" | \ { IFS= read -r pass; printf %s "$pass"; } | \ xdotool type --clearmodifiers --file - if [ "$newline" = 1 ]; then - #sleep 1 xdotool key Return fi else - pass show -c "$_passfile" + gpg -q -d "${_passfile}" | xclip fi } -verbose=0 typeout=0 newline=0 prefix="" @@ -110,13 +97,6 @@ while :; do show_help exit 0 ;; - -v) - show_version - exit 0 - ;; - -V) - verbose=1 - ;; -t) typeout=1 ;;