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

Re: compctl -l

    Hi Bart :))

    Definitely, if you ever come to Spain, I owe you a good dinner ;))

 * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> }     I'm trying to learn now the old completion code (compctl), but
> } I'm clueless with option '-l'.
> Have you looked at Misc/compctl-examples yet?

    Yes, I've read them, although I've not tried to understand all of
them, since I've not read all the -x completion yet.
> "compctl -l foo bar" means that, if there exists a compctl for "foo",
> then use that when completing arguments of "bar".  It's like aliasing.
> If there is not a compctl for "foo", it's useless.

    Yes, this one was the first I got, because the examples are more
or less clear and my own experiments led me to this conclussion.

> "compctl -l '' bar" means that "bar" should be ignored for purposes of
> completion; that is, the first word after "bar" completes as a command,
> and the second and further words complete as arguments of the command
> named by the first word.  The classic example is
>     compctl -l '' nohup noglob exec nice eval - time rusage

    Yes, this is another clear use I understood. The '-' doesn't
confuse compctl?

> "compctl -x ... -l ..." is the real meat

    And the one I really didn't understand. I mean, the -x args
(specially p, P and r comes to mind) delimit a portion of the command
line that must be completed specially (well, more or less), and the
-l says if it must be completed as a command itself or as an
specified command. No problem with it. What confused me is the
documentation about -l:

    -l CMD
        This option restricts the range of command line words that
are considered to be arguments. [...] . Completion is then performed
as if these had been given as arguments to the CMD supplied with the

    IMHO, this option doesn't really restricts what in the command
line is an argument :??? It is more like an alias. The only way of
really restricting ranges is using -x. And the second paragraph...
Well, I must admit that my completion knowledge is worse than my
english, but I don't get the meaning of that... The completion is
performed in two ways: command-like or using 'CMD' completion :??

> Note that order is important with "-x"

    Yes, I've read that in the manual.

> Of course this stuff about -x generalizes to other options besides -l,
> but -l is what you were asking about ...

    I've used it with -u, for example, for completing user names,
just like the example in the manual.

    Well, thanks a lot for your explanation. The fact is that I got
more or less well how -l works, but the documentation is bizarre...

    Raúl Núñez de Arenas Coronado

Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/

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