Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Glob problem



On Wed, 23 Oct 2013 08:27:22 -0400
Brent Briggs <brent.briggs@xxxxxxxxx> wrote:
> This did the job. I still have one question. I can't find any
> documentation for the "--" option. What does it do exactly?

It's documented for shell invocation in the zsh manual page, but I don't
see anything about option handling for builtins.  There probably should
be something.  Some of the regulars can tell me if the following looks
right.

diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 1d9fe68..e9fc7bf 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -28,6 +28,33 @@ See ifzman(the section `Zle Builtins' in zmanref(zshzle))\
 ifnzman(noderef(Zle Builtins)).
 )\
 )\
+
+Some shell builtin commands take options as given in invidiual entries.
+Typically options are single letters preceded by a hyphen (tt(-)).
+Options that take an argument accept it either immediately following the
+option letter or after white space, for example `tt(print -C3 *)' or
+`tt(print -C 3 *)' are equivalent.  Arguments to options are not the
+same as arguments to the command; the documentation indicates which is
+which.  Options that do not take an argument may be combined in a single
+word, for example `tt(print -ca *)' and `tt(print -c -a *)' are
+equivalent.
+
+Some shell builtin commands also take options that begin with `tt(+)'
+instead of `tt(-)'.  These commands are indicated in the list below.
+
+Options must appear in a group before any non-option arguments;
+once the first non-option argument has been found, option processing is
+terminated.
+
+All builtin commands other than precommand modifiers, even those that
+have no options, can be given the argument `tt(--)' to terminate option
+processing.  This indicates that the following words are non-option
+arguments, but is otherwise ignored.  This is useful in cases where
+arguments to the command may begin with `tt(-)'.  For historical
+reasons, most builtin commands also recognize a single `tt(-)' in a
+separate word for this purpose; note that this is less standard and
+use of `tt(--) is recommended.
+
 startitem()
 prefix(-)
 findex(.)

pws



Messages sorted by: Reverse Date, Date, Thread, Author