Defining ZSH completion function (compdef) for multiple commands

Viewed 1381

I have a ZSH completion script called

#compdef kubens
_arguments "1: :(- $(kubectl get namespaces -o=jsonpath='{range .items[*].metadata.name}{@}{"\n"}{end}'))"

This provides completion to the kubens command. However if user provides a certain installation argument, the program is linked with kns name, so I am trying to provide completion for both of these commands uing the same #compdef.

How do I achieve that?

1 Answers
Related