Suggestion: -p flag for "picking" content from pass show

Danielle McLean dani at
Thu Apr 27 07:56:34 CEST 2017

Hi! Currently, the `pass show` subcommand supports two flags, -c /
--clip and -q / --qrcode. These flags, respectively, copy the command
output to the clipboard and convert the command output to QR code form -
but they *also* allow you to specify a line number, selecting which part
of the decrypted file should be output. That's useful functionality in
many contexts; for example, retrieving necessary credentials from your
password store in a script, programmatically.

I suggest that `pass show` be taught a new flag, -p, which accepts the
same line number argument and simply displays the specified line
directly, rather than performing additional transformations on it. (The
long form of this flag could be either --print or --pick.)

Additionally, I propose that the supported argument be broadened: rather
than a single line number, ranges like 3,5 and 2,$ should be recognised
and function as you'd expect. Note how the latter subsumes the
functionality of pass-extension-tail's `pass tail` subcommand.

Finally, to aid in retrieving the values of "fields", I propose a third
extension: an argument to -p (or -c or -q) that starts with an
alphabetic character would be treated as a prefix string. The output
would be scanned for a line that begins with that prefix, and the
*remaining* text on that line would be output. For example:

$ pass show
some really secure password here
username: cool at
recovery key: G-i forget what format these are in
$ pass show -p 'username: '
cool at
$ pass show -p 'recovery key: '
G-i forget what format these are in

This would allow for the retrieval of info stored in the file in a
variety of arrangements, while eliminating the dependence on the order
of lines implied by only supporting actual line numbers. It'd be
especially valuable in scripts:

username="$(pass show someCoolSite -p 'username: ')"
answer1="$(pass show someCoolSite -p 'secret question 1: ')"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Password-Store mailing list