edgelesssys / contrast

Deploy and manage confidential containers on Kubernetes
https://docs.edgeless.systems/contrast
GNU Affero General Public License v3.0
183 stars 7 forks source link

cli: tab completion not working #596

Closed m1ghtym0 closed 3 months ago

m1ghtym0 commented 3 months ago

There is an issue with the tab completion

The completion is not initialized correctly. Basically, the generated completion script is missing the command it's intended for: "contrast". See the header of the generated script:

$fpath[1]/_contrast

compdef _

vs.

compdef _constellation constellation

You can see the same behavior on the help command that shows incomplete "completion" commands. It misses the "contrast" prefix to the "[contrast] completion ...":

$ contrast completion bash -h
...
To load completions in your current shell session:

        source <( completion zsh)

To load completions for every new session, execute once:

#### Linux:

         completion zsh > "${fpath[1]}/_

Same for the bash commands.

This is due to a missing "Use" field in the Cobra initialization: https://github.com/edgelesssys/contrast/blob/main/cli/main.go#L32