commit 46780a1c76886ff4af4176ea3534c216f0828d04 parent c32b43e5c3ba25c711780db63fce4012dcea2e27 Author: Jason A. Donenfeld <Jason@zx2c4.com> Date: Fri, 5 Feb 2016 22:27:18 +0100 show: better clip error message Diffstat:
M | src/password-store.sh | | | 6 | +++--- |
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/password-store.sh b/src/password-store.sh @@ -313,9 +313,9 @@ cmd_show() { if [[ $clip -eq 0 ]]; then $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $? else - [[ $clip_location =~ ^[0-9]+$ ]] || die "Clip location '$clip_location' is not a number" - local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n $clip_location | tail -n 1)" - [[ -n $pass ]] || exit 1 + [[ $clip_location =~ ^[0-9]+$ ]] || die "Clip location '$clip_location' is not a number." + local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +${clip_location} | head -n 1)" + [[ -n $pass ]] || die "There is no password to put on the clipboard at line ${clip_location}." clip "$pass" "$path" fi elif [[ -d $PREFIX/$path ]]; then