Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: optional argument?
- X-seq: zsh-workers 11257
- From: Tanaka Akira <akr@xxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: optional argument?
- Date: 08 May 2000 23:49:01 +0900
- In-reply-to: <200005080944.LAA15834@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> (Sven Wischnowsky's message of "Mon, 8 May 2000 11:44:16 +0200 (MET DST)")
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <200005080944.LAA15834@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
In article <200005080944.LAA15834@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> Well, in this case it is really caused by --context not accepting its
> argument in a separate word.
Yes. So, I used `--context=-' in _cvs for `cvs diff'. However this
is bit annoying because `=' is not removal suffix.
> Hm, what are we supposed to do now? Generally making it not complete
> normal arguments when in a position for an optional option-argument
> wouldn't solve the problem. Making it not complete optional option-
> arguments in separate words could be wrong, too, for commands that can
> find out if the argument is a normal or for the option.
Actual commands which has optional arguments judge whether they are
specified or not in a some criteria. So, supporting some common
criteria is useful.
> Hrmpf. Make `='-options complete the argument *only* after the equal
> sign? Add a new specification type, say `-opt==' for options that
> don't accept the argument in a separte word (should the long-option
> auto-detection code use it then?)?
Exactly, the existence of `=' is the criteria used by getopt_long. So
it's good. But I vote `-opt=?' instead of `-opt=='.
Note that another common criteria is that a optional argument must be
some set of strings: `yes' or `no' for example. At least, xset
handles optional arguments in this way. If we can specify a pattern
addition to the current optional argument syntax, it can be handled.
However, _xset cannot use _arguments since it has more anomalies if
the optional arguments can be handled.
Apart from that, I hope a extension for _arguments. There are
many duplicated descriptions such as:
....
'(-i)--ignore-case[case insensitive]' \
'(--ignore-case)-i[case insensitive]' \
'(-w)--ignore-all-space[ignore all white space]' \
'(--ignore-all-space)-w[ignore all white space]' \
'(-b)--ignore-space-change[ignore changes in the amount of white space]' \
'(--ignore-space-change)-b[ignore changes in the amount of white space]' \
'(-B)--ignore-blank-lines[ignore lines that are all blank]' \
'(--ignore-blank-lines)-B[ignore lines that are all blank]' \
'(-I)--ignore-matching-lines=[ignore lines that match regex]:line exclusion regex:' \
'(--ignore-matching-lines)-I+[ignore lines that match regex]:line exclusion regex:' \
...
So, I really want to describe them as:
...
'--ignore-case,-i[case insensitive]' \
'--ignore-all-space,-w[ignore all white space]' \
'--ignore-space-change,-b[ignore changes in the amount of white space]' \
'--ignore-blank-lines,-B[ignore lines that are all blank]' \
'--ignore-matching-lines=,-I+[ignore lines that match regex]:line exclusion regex:' \
...
In other words, I think it is useful that opt-spec is comma separated
list of options. And exclusive options are automatically set up each
other if they are not prefixed as `*'.
--
Tanaka Akira
Messages sorted by:
Reverse Date,
Date,
Thread,
Author