Shell completion support
Why it matters
Shell completions turn mytool dep<TAB> into mytool deploy and mytool deploy --en<TAB> into mytool deploy --environment. Power users depend on them; new users discover commands through them. A CLI with twelve subcommands and no completion support forces users to consult --help for every invocation. Completion scripts are cheap to generate (one line in cobra, one crate in clap, built into oclif) and disproportionately improve daily use.
Severity rationale
Info because completions are a usability enhancement, not a correctness or availability concern.
Remediation
Add a completions subcommand that emits bash/zsh/fish scripts to stdout, and document the install one-liner in README. For cobra in cmd/completion.go:
var completionCmd = &cobra.Command{
Use: "completion [bash|zsh|fish]",
RunE: func(cmd *cobra.Command, args []string) error {
return rootCmd.GenBashCompletion(os.Stdout)
},
}
Users install with mytool completion bash > /etc/bash_completion.d/mytool.
Detection
-
ID:
shell-completions -
Severity:
info -
What to look for: List all completion script generation capabilities. check for shell completion generation or documentation. In commander, check for
program.enablePositionalOptions()or completion plugins. In oclif, completions are built-in. In cobra, check forGenBashCompletion/GenZshCompletion/GenFishCompletionmethods. In clap, check forgeneratefunction fromclap_complete. Look for acompletionsorcompletionsubcommand, or documentation about shell completion setup. -
Pass criteria: The CLI provides shell completion scripts via a subcommand (
mytool completions bash), a--completionsflag, or has completion setup documented. At least bash and zsh are supported — at least 1 shell completion script (bash, zsh, or fish) should be generated or provided. Report: "X shell completion scripts available." -
Fail criteria: No shell completion support and no documentation about completion setup.
-
Skip (N/A) when: The CLI has 2 or fewer commands with no complex options — completion adds little value. All checks skip when no CLI entry point is detected.
-
Detail on fail:
"No shell completion support found — no 'completions' subcommand, no completion generation, and no documentation for completion setup" -
Remediation: Shell completions dramatically improve the user experience for CLIs with many commands:
// Node.js — tabtab or omelette for completions // Or with oclif, completions are built in: // mytool autocomplete bash // cobra (Go) — built-in completion generation var completionCmd = &cobra.Command{ Use: "completion [bash|zsh|fish|powershell]", Short: "Generate shell completion scripts", RunE: func(cmd *cobra.Command, args []string) error { switch args[0] { case "bash": return rootCmd.GenBashCompletion(os.Stdout) case "zsh": return rootCmd.GenZshCompletion(os.Stdout) } return nil }, }// clap (Rust) — clap_complete crate use clap_complete::{generate, shells::Bash}; generate(Bash, &mut cli, "mytool", &mut io::stdout());
Taxons
History
- 2026-04-18·v1.0.0·Initial import from cli-quality·automated