Tab completion should also look at the Kargo API
Checklist
- [x] I've searched the issue queue to verify this is not a duplicate feature request.
- [x] I've pasted the output of
kargo version, if applicable. - [x] I've pasted logs, if applicable.
Proposed Feature
When using kargo cli, the tab completion should also look at the API that the CLI auth'ed against. Similar to Kubernetes.
Currently:
$ kargo get projects kargo<TAB>
kargo/ kargo-render.yaml
^ These are local files.
Where as in Kubernetes
$ kubectl get namespaces kargo<tab>
kargo kargo-demo
^ Those are namespaces (what I actually want)
It would be nice if I could get this.
$ kargo get projects kargo<tab>
kargo-demo
^ tabs out to just show the current projects.
All subcommands should follow this.
Motivation
Make it act more like Kubernetes and other CLI tools.
Suggested Implementation
A good place to look is the kubectl code. Not sure what's involved
@christianh814 I've wanted this as well. Thanks for opening the issue.
@hiddeco or @jessesuen in case you know what's involved. I do not.
This definitely won't get into v0.6.0.
This is done through "dynamic completion" in Cobra (https://github.com/spf13/cobra/blob/v1.6.x/shell_completions.md#dynamic-completion-of-nouns).
@hiddeco tried that just now to satisfy my own curiosity and wasn't able to get it working. Maybe when time permits, you can show me what I am doing wrong.