zsh-users
 help / color / mirror / code / Atom feed
* Completion of mkisofs find operators
@ 2006-11-19 23:20 Nikolai Weibull
  2006-11-20  9:04 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolai Weibull @ 2006-11-19 23:20 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Completion of mkisofs find operators
  2006-11-19 23:20 Completion of mkisofs find operators Nikolai Weibull
@ 2006-11-20  9:04 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2006-11-20  9:04 UTC (permalink / raw)
  To: zsh-users

On Nov 19,  3:20pm, Nikolai Weibull wrote:
}
} 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.

Taking _find as an example, the best way seems to be not to implement it
at all.  They're single-letter options so having a completion for them
is not going to save any typing, and having them in there does not stop
the primaries from completing after them, so ...

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

And 01:03 isn't the best time for complicated answers. :-)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-20  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-19 23:20 Completion of mkisofs find operators Nikolai Weibull
2006-11-20  9:04 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).