Re: Help overriding a single flag’s completion action

Langbart <[email protected]> Mon, 13 Oct 2025 05:34:32 +0000
Newsgroups gmane.comp.shells.zsh.user
Message-ID <apgKsXxIZyI4ANVjhk-2WifBfQo46QNJ8tXsZrrllQHcta8A87xL-k_0EC1GpqjqPpFVm6V9d4xxQTo8BzlqrU7p1ClnatCxZc-6fMuw5J4=@protonmail.com>
> Could you advise on the correct approach?

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

_fab_wrap() {
  if ((CURRENT > 1)) && [[ ${words[CURRENT - 1]} =~ '-m|--model' ]]; then
    # Minimal Example
    local -a my_itmes=(
      'alpha:100k'
      'beta:20k'
      'gamma:4k'
    )
    _describe '' my_itmes
    return 0
  fi
  _fabric-ai "$@"
}

compdef _fab_wrap fabric-ai