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 4b9493450de216624afe55f17b33ee2a3d61130d
parent c9dd31af128a54c7f71c8b3be8190b8d07511d2a
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 22 Jan 2020 14:22:19 +0100

Improve error handling in passmenu

Diffstat:
M.local/bin/passmenu | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/.local/bin/passmenu b/.local/bin/passmenu @@ -1,8 +1,6 @@ #!/bin/sh # requirements: pass(1), dmenu(1), xdotool(1) for -t, -n and -u options -set -e - version=0.1.0 pass_dir="$HOME/.password-store" @@ -71,6 +69,9 @@ match_password_file() fi else _passfile="$(printf '%s\n' "$_passfiles" | dmenu -i)" + if [ $? -ne 0 ]; then + die 'aborted by user' + fi fi if [ ! -r "$pass_dir/$_passfile" ]; then die "no password file: $pass_dir/$_passfile" @@ -138,4 +139,9 @@ while :; do shift done -retrieve_password "$(match_password_file "$@")" +pass="$(match_password_file "$@")" +if [ -n "$pass" ]; then + retrieve_password "$pass" +else + exit 1 +fi