github.com/containerd/containerd@v22.0.0-20200918172823-438c87b8e050+incompatible/contrib/autocomplete/zsh_autocomplete (about)

     1  #compdef ctr
     2  # This file is a direct copy of https://github.com/urfave/cli/blob/d04c0883fcc8860836ab30ade0fd29afa194ab23/autocomplete/zsh_autocomplete
     3  # With $PROG changed to ctr
     4  
     5  _cli_zsh_autocomplete() {
     6  
     7    local -a opts
     8    local cur
     9    cur=${words[-1]}
    10    if [[ "$cur" == "-"* ]]; then
    11      opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
    12    else
    13      opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
    14    fi
    15  
    16    if [[ "${opts[1]}" != "" ]]; then
    17      _describe 'values' opts
    18    fi
    19  
    20    return
    21  }
    22  
    23  compdef _cli_zsh_autocomplete ctr