Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
run-help's man arguments
- X-seq: zsh-workers 27035
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: run-help's man arguments
- Date: Fri, 05 Jun 2009 12:10:52 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
I've only recently started using the vanilla run-help supplied with the
shell. Ages ago, in
http://www.zsh.org/mla/workers//2000/msg01589.html
run-help got changed to invoke "man $@" rather than "man $1". This was
described as being "to allow the specification of sections and other man
options through" (sic, presumably something missing?)
The text has changed since then, but the basic feature is still there.
Nobody's ever complained about this, but this is surely weird; that's
not how you use run-help, the $@ is the stuff on the command line which
doesn't include anything for "man" unless you type it yourself, which is
rather against the spirit of run-help (and very well hidden).
I ran into this running run-help on
locate -r stuff
which caused man to barf immediately due to the annoying and confusing
GNU feature that options can occur anywhere on the command line, so -r
is picked up as an option to "man" rather than "locate". This
particular problem is fixed by
POSIXLY_CORRECT=1 man $@:t
which is presumably benign for other versions of man so I'll commit it.
However, the original query remains. Why do we need $@ rather than $1?
Why do I need man to produce the error messages
No manual entry for -r
No manual entry for stuff
?
I can see that help on something like "nice locate -r stuff" (stupid
example) or even "nice -n 10 locate -r stuff" does something sensible
but with some harmless error messages. Is this the correct rationale?
Index: Functions/Misc/run-help
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Misc/run-help,v
retrieving revision 1.15
diff -u -r1.15 run-help
--- Functions/Misc/run-help 25 Apr 2009 20:30:20 -0000 1.15
+++ Functions/Misc/run-help 5 Jun 2009 11:06:22 -0000
@@ -8,8 +8,7 @@
# autoload run-help
#
-emulate -R zsh
-setopt localoptions
+emulate -RL zsh
local HELPDIR="${HELPDIR:-/usr/share/zsh/$ZSH_VERSION/help}"
@@ -103,7 +102,7 @@
done
eval "run-help-$1:t ${(q@)cmd_args[2,-1]}"
else
- man $@:t
+ POSIXLY_CORRECT=1 man $@:t
fi
fi
;;
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author