[PATCH] Series => Better support for `--field=...` and `--qrcode`
Robert Ames
ramses0 at yahoo.com
Tue Jul 23 08:36:15 CEST 2019
Presented in a "slow refactor" series, and including extra tests, these patches support the following workflow to be able to work more ergonomically with lines and fields of password files.
Basically, the first part is set up to split out "what are you trying to pull out of gpg?" and "how are you trying to display that to the user?".
Once that split's been made, then it's a simple matter of adding --line, and --field support for "filtering", and then there's a few improvements made to allow --line or --field to be simply printed, copied to clipboard, etc. The QR-Code patch has a dependency on the previous "YES_TTY" patch which I submitted previously.
Hopefully it's clear about the ergonomics around this. The specific use case I was targeting was multi-value credentials (ie: S3 username, password, access-key, bucket-id, etc) which I wanted to be able to pull out the appropriate fields in a scriptable fashion. In order to do that, it was easier to fix the jumble of clipboard/qrcode/etc. before trying to add a new feature to it.
`--clip` still maintains the ability to specify a line number for convenience and backwards compatibility, but the addition of `--line` is critical to segregate out `--clip` and `--qrcode` as two distinct output types. That is to say: `--clip=2` and `--line=2 --clip` are equivalent, but `--line=2 --qrcode` and `--field=foo --clip` seem like incredibly important use cases (and are supported by this patch series).
$ printf "hello\ntarget: world\n" | ./src/password-store.sh insert -m test
Enter contents of test and press Ctrl+D when finished:
[master fff1234] Add given password for test to store.
1 file changed, 0 insertions(+), 0 deletions(-)
rewrite test.gpg (100%)
$ ./src/password-store.sh show test
hello
target: world
$ ./src/password-store.sh show test --line=2
target: world
$ ./src/password-store.sh show test --field=target
world$ ./src/password-store.sh show test --field=target --clip && echo $( xclip -selection c -o )
world$ ./src/password-store.sh show test --field=target --qrcode | cat██████████████████████████████████████████████████████████
████ ▄▄▄▄▄ █▀ █ ▄█ ▄▄▄▄▄ ████
████ █ █ █▄ █▀▄█ █ █ ████
████ █▄▄▄█ █ ██▀ █ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ ▀ ▀ █▄▄▄▄▄▄▄████
████▄▄▀▄▀▀▄ █▄ ███ ▄▄█ ▀████
████ █ ▀▀▄▀▀▀█▀▄▄███ ██▄████
███████▄█▄▄▄ █▀▀▄█▄▀ █ ████
████ ▄▄▄▄▄ █▄▄ ▀▀ █ ▀▄█▄█████
████ █ █ █▀█▀ ██▄ ▄▀▀▀ ████
████ █▄▄▄█ █▀█▄█▄▀▀▀ █▄█▄████
████▄▄▄▄▄▄▄█▄▄▄▄▄██▄▄▄█▄█████
█████████████████████████████
█████████████████████████████
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20190723/bae84f5e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Lift-password-extraction-gpg-usage-out-of-two-code-p.patch
Type: text/x-patch
Size: 1534 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20190723/bae84f5e/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Push-down-default-printing-behavior-to-a-password-ou.patch
Type: text/x-patch
Size: 1914 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20190723/bae84f5e/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Add-robustness-for-qrcode-generation-including-pipel.patch
Type: text/x-patch
Size: 2807 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20190723/bae84f5e/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Add-field-f-and-line-l-support.patch
Type: text/x-patch
Size: 6054 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20190723/bae84f5e/attachment-0007.bin>
More information about the Password-Store
mailing list