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

Re: Using the same completion function for various commands



2010/12/6 Peter Stephenson <Peter.Stephenson@xxxxxxx>:
> On Mon, 6 Dec 2010 16:03:51 +0100
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
>> 2010/12/6 JÃrÃmie Roquet <arkanosis@xxxxxxxxx>:
>> > Hi,
>> >
>> > 2010/12/6 Mikael Magnusson <mikachu@xxxxxxxxx>:
>> >> You can also do this in your .zshrc instead of in the completer if
>> >> you wish, just write
>> >> compdef _foo -p 'foo_*'
>> >>
>> >> At least that's what the documentation says, it doesn't seem to
>> >> work that well.
>> >
>> > It works fine for me with 4.3.10, did I miss something?
>>
>> When i tried compdef _du -p foo_\*, i only got single-letter options
>> completed.
>>
>
> That means it's working perfectly. ÂIt's hitting this line at the top of
> _du
>
> Â_pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file
>
> and deciding, quite reasonably in my opinion, that foo_\* is not a GNU
> variant of du. ÂSo it's going to the other branch, where the options are
> simpler.

I'm getting some weird behaviour with some commands, though. For example :

$ aap -<tab>
--                          -- end of options, targets and assignments follow
--changed                   -- consider specified file changed
--command         -c        -- execute a command after reading the recipe
--contents        -C        -- only build when file contents changed
<snip>

$ compdef _aap bar
$ bar -<tab>
--                          -- end of options, targets and assignments follow
--changed                   -- consider specified file changed
--command         -c        -- execute a command after reading the recipe
--contents        -C        -- only build when file contents changed
<snip>

$ compdef _aap -p baz
$ baz -<tab>
zsh: do you wish to see all 1152 possibilities (1154 lines)?<y>
option
--
--changed
--command
--contents
<snip>
<space>
<space>
<snip>
-c
-C
-k
<snip>
<space>
<space>
<snip>
-- end of options, targets and assignments follow
-- consider specified file changed
-- execute a command after reading the recipe
<snip>

I guess there is something wrong in _aap, but I don't understand why
the behaviour is different with and without the -p

Best regards,

-- 
JÃrÃmie



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