[RFC PATCH] Add option to print the first line of an entry

Rene Kita mail at rkta.de
Wed Dec 29 16:19:15 UTC 2021


On Sat, Dec 25, 2021 at 10:19:59AM +0100, Johannes Altmanninger wrote:
> On Mon, Dec 20, 2021 at 01:40:26PM +0100, Rene Kita wrote:
> > This commit enables the use of '-1' to print only the first line of an
> > entry. A typical use-case would be: 'password=$(pass -1 example.org)' or
> > 'pass -1 example.org | tmux loadb -'. Before this change one had to use
> > 'sed 1q' or similar when using multi-line entries.
> 
> I like this feature, thanks. It adds convenience, and is consistent with
> --clip=<line-number> and --qrcode=<line-number>
Thanks for your feedback!

> Of course -1 is probably way less common than  --clip, so maybe it's not
> worth it, I'm not sure.
I have to disagree. ;) I need -1 way more often then --clip. But maybe I
just have an unusual workflow.

> (Regarding the other thread, I also don't think this should be pushed to
> extensions, since it's a pretty common/core feature, and making the user
> type the extension name kind of defeats the point.)
> 
> The synopsis on error (like "pass -h") also needs an update:
> 
> diff --git a/src/password-store.sh b/src/password-store.sh
> index 77f7ad5..bb50431 100755
> --- a/src/password-store.sh
> +++ b/src/password-store.sh
> @@ -378,7 +378,7 @@ cmd_show() {
>  		--) shift; break ;;
>  	esac done
>  
> -	[[ $err -ne 0 || ( $qrcode -eq 1 && $clip -eq 1 ) ]] && die "Usage: $PROGRAM $COMMAND [--clip[=line-number],-c[line-number]] [--qrcode[=line-number],-q[line-number]] [pass-name]"
> +	[[ $err -ne 0 || ( $qrcode -eq 1 && $clip -eq 1 ) ]] && die "Usage: $PROGRAM $COMMAND [-1] [--clip[=line-number],-c[line-number]] [--qrcode[=line-number],-q[line-number]] [pass-name]"
>  
>  	local pass
>  	local path="$1"
Thanks, will add that to v1. The completion files/functions also need an
update; I'll add that too.


More information about the Password-Store mailing list