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

Completion of mkisofs find operators



OK, another question regarding the -find option to mkisofs.

The options -a (logical AND) and -o (logical OR) are only interesting
after primaries, e.g., in "-mtime X -o -atime Y".  But the question is
how I best implement this.  I figured that all primaries, e.g.,
-mtime, would take a second optional argument (optional, as logical
AND is the default operator between primaries if none is given) that
would generate the two operators in question.  So my solution thus far
is

(( $+functions[_mkisofs_find_operators] )) ||
_mkisofs_find_operators () {
 _values 'find operator' \
   '*-a[logical and of options]' \
   '*-o[logical or of options]'
}

 '*-atime[true if the last-access time is in the specified
range]:range: ::_mkisofs_find_operators'

which works fine, except that options aren't listed after -atime
anymore, unless I delete the "-" that is automatically inserted when I
begin completion after the range argument to -atime.  (Though, if I
cycle through the matches, the options are given after -a and -o have
been given).

Wow, that's a terrible description of my problem, but I don't think I
can make it clearer.  I'll attach the completion function next time if
no one gets what I'm talking about.  My guess is that I should be
using a tag loop somewhere, but I'm not sure how and why.

Perhaps this is a better description of my problem:

Say that I have the following command line:

% mkisofs -find -atime X

and then I press <Tab>

% mkisofs -find -atime X <Tab>

this will give me

% mkisofs -find -atime X -
::: find operator :::
-a logical and of options
-o logical or of options

If I press <Tab> again auto-listing kicks in and I get

% mkisofs -find -atime X -a

pressing <Tab> again gives me a '-o' instead.  Another <Tab> then
begins completing options specified with _arguments, as the argument
is considered optional.  I would like the options specified with
_arguments to be listed immediately, like it would be if I deleted the
automatically inserted dash:

% mkisofs -find -atime X -<Backspace>-<Tab>
::: find operator :::
-a logical and of options
-o logical or of options
::: option :::
-acl true if the file has additional ACLs defined
:
:

Hm, perhaps 00:18 isn't the right time to ask complicated questions...

 nikolai



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