Summary
datumctl has no shell completions today. Users tab-completing commands,
subcommands, flags, and resource type names get nothing. Cobra has built-in
completion support — the bulk of the work is wiring it up and adding dynamic
completion for resource type arguments.
Note: This is a human UX feature. AI tools and automated pipelines
construct commands programmatically and do not benefit from shell completions.
The target audience is developers typing datumctl interactively in a terminal.
What should complete
| Input |
Completes to |
datumctl <TAB> |
subcommands (get, apply, auth, ai, …) |
datumctl get <TAB> |
resource types fetched live from api-resources (e.g. projects, dnszones, domains) |
datumctl describe <TAB> |
same as above |
datumctl delete <TAB> |
same as above |
datumctl edit <TAB> |
same as above |
datumctl explain <TAB> |
same as above |
datumctl auth <TAB> |
auth subcommands |
datumctl --<TAB> |
flags for the current command |
Implementation notes
Cobra's completion command (cmd.GenBashCompletion, GenZshCompletion, etc.)
handles static command/flag completion out of the box — just add the completion
command to root.
Dynamic resource type completion requires registering a ValidArgsFunction on
get, describe, delete, edit, and explain that calls the API and returns
resource type names. This is the same data datumctl api-resources returns; the
completion function can reuse that path.
The completion command should be hidden from the main help group (same pattern as
generate-cli-docs) since it is a setup utility, not an everyday command.
Acceptance criteria
Summary
datumctlhas no shell completions today. Users tab-completing commands,subcommands, flags, and resource type names get nothing. Cobra has built-in
completion support — the bulk of the work is wiring it up and adding dynamic
completion for resource type arguments.
What should complete
datumctl <TAB>get,apply,auth,ai, …)datumctl get <TAB>api-resources(e.g.projects,dnszones,domains)datumctl describe <TAB>datumctl delete <TAB>datumctl edit <TAB>datumctl explain <TAB>datumctl auth <TAB>datumctl --<TAB>Implementation notes
Cobra's
completioncommand (cmd.GenBashCompletion,GenZshCompletion, etc.)handles static command/flag completion out of the box — just add the completion
command to root.
Dynamic resource type completion requires registering a
ValidArgsFunctiononget,describe,delete,edit, andexplainthat calls the API and returnsresource type names. This is the same data
datumctl api-resourcesreturns; thecompletion function can reuse that path.
The completion command should be hidden from the main help group (same pattern as
generate-cli-docs) since it is a setup utility, not an everyday command.Acceptance criteria
datumctl completion bash/zsh/fish/powershelloutputs a valid completion scriptdatumctl get <TAB>completes with live resource typesdatumctl describe/delete/edit/explain <TAB>get the same dynamic completions