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

Re: Help overriding a single flag’s completion action




On 10/13/25 1:34 AM, Langbart wrote:
Could you advise on the correct approach?

I tried zstyle first but never found the right syntax; using compdef with a helper function worked.

zstyle :completion::complete:fabric:\*:option--model-1 fake foo bar baz

you type fabric --model and press ^xh to invoke _complete_help to get the `context' the completion system has

% fabric --model                                                                                                                                                                                                                            ~
tags in context :completion::complete:fabric::
    option--model-1  (_arguments _fabric _foo)

you choose the appropriate tag, in this case,option--model-1 is the only option.

you then use the fake style to set the values that you want for the given context, these values are set at
the time zstyle runs, not when completion is attempted. if you would like the latter you could change it to

zstyle -e :completion::complete:fabric:\*:option--model-1 fake 'reply=( ... )'




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