Add example to pick.1 for handling empty result set in the shell
authormarkus schnalke <meillo@marmaro.de>
Sat, 8 Jul 2017 12:34:04 +0000 (14:34 +0200)
committermarkus schnalke <meillo@marmaro.de>
Sat, 8 Jul 2017 12:34:04 +0000 (14:34 +0200)
This commit bases on a patch provided by Vasily Kolobkov
<polezaivsani@openmailbox.org>. Actually, he also brought the
topic up on the mailing list. Thanks!

Also adjust the man page from nmh's special sequence name `all'
to mmh's name `a' for it.

man/pick.man1

index 076f99d..2390984 100644 (file)
@@ -223,7 +223,7 @@ switches are provided, which act just like opening and closing
 parentheses in logical expressions.
 .PP
 If no search criteria are given, all the messages specified on the
 parentheses in logical expressions.
 .PP
 If no search criteria are given, all the messages specified on the
-command line are selected (this defaults to `all').
+command line are selected (this defaults to `a').
 .PP
 Once the search has been performed, if the
 .B \-list
 .PP
 Once the search has been performed, if the
 .B \-list
@@ -315,7 +315,7 @@ mark(1)
 .SH DEFAULTS
 .nf
 .RB ` +folder "' defaults to the current folder"
 .SH DEFAULTS
 .nf
 .RB ` +folder "' defaults to the current folder"
-.RB ` msgs "' defaults to all"
+.RB ` msgs "' defaults to all messages"
 .RB ` "\-datefield date" '
 .RB ` \-zero '
 .RB ` \-list "' is the default if no `\-sequence', `\-nolist' otherwise"
 .RB ` "\-datefield date" '
 .RB ` \-zero '
 .RB ` \-list "' is the default if no `\-sequence', `\-nolist' otherwise"
@@ -417,5 +417,16 @@ was given, and if its standard output is not a tty, then
 outputs the illegal message number `0'
 when it fails.  This lets the outer command fail gracefully as well.
 .PP
 outputs the illegal message number `0'
 when it fails.  This lets the outer command fail gracefully as well.
 .PP
+To account for this case when combining
+.B pick
+with regular shell tools, filter out the message number `0'.
+For example, do
+.PP
+.RS 5
+pick\0...\0|\0fgrep\0-vx\0\&0\0|\0wc\0-l
+.RE
+.PP
+to count the number of messages picked.
+.PP
 The pattern syntax `[l-r]' is not supported; each letter to be
 matched must be included within the square brackets.
 The pattern syntax `[l-r]' is not supported; each letter to be
 matched must be included within the square brackets.