[pass] [PATCH] grep: Change output format and update man page.
l-m-h at web.de
l-m-h at web.de
Mon Nov 17 11:03:39 CET 2014
Hello list,
I tried to do some scripting with ``pass grep'' and was unhappy with the
output format. I suggest the attached patch. It will simplify the logic of
the cmd_grep function and remove some redirection to shell variables of
(potentially big) matches. At the same time it will change the output format
of the grep subcommand and thereby change the "public interface" of the API of
pass (if such a thing is of concern).
The commit message could be:
> grep: Change output format and update man page.
>
> The grep option --color=auto is used to color the output if and only if output
> is to a terminal. This makes it more suitable for scripts.
>
> The grep option --label=$label is used (together with -H) to print any
> string to appear as the filename if grep searches stdin. This makes it
> possible to display the password name on the same line as the match. This
> makes it more suitable for further line wise processing in scripts.
>
> The man page falsely stated that the filename would be displayed with the
> matches. Actually the password name is displayed.
Note about portability: The --color option was already used, the --label
option is present in GNU grep and according to
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/grep.1.html
http://www.unix.com/man-page/FreeBSD/1/grep/ also on Mac OS X and FreeBSD.
According to http://nixdoc.net/man-pages/OpenBSD/man1/grep.1.html it is not
present in OpenBSD (and -H has a different semantics) but --color doesn't seem
to be present either (so this patch does not break portability any further).
I do not know about Cygwin, as I did not find a man page online.
When I updated the man page my editor automatically deleted a lot of trailing
white space. I'm sorry for this but I ran ``diff <(man 1 pass) <(man
man/pass.1)'' and checked that it does not change the formatted man page.
I'm happy to update the patch if there are some concerns. Thanks for
developing pass and kind regards
Lucas
---
man/pass.1 | 164 +++++++++++++++++++++++++-------------------------
src/password-store.sh | 14 ++---
2 files changed, 87 insertions(+), 91 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-grep-Change-output-format-and-update-man-page.patch
Type: text/x-patch
Size: 11475 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20141117/f4142f87/attachment.bin>
More information about the Password-Store
mailing list