-
-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add distill completion command that generates shell completions for Bash, Zsh, Fish, and PowerShell.
Motivation
Shell completions are a low-effort, high-polish feature that signals CLI maturity. Cobra provides built-in support.
Implementation
Cobra has built-in completion generation. Add a completion command:
// cmd/completion.go
var completionCmd = &cobra.Command{
Use: "completion [bash|zsh|fish|powershell]",
Short: "Generate shell completion scripts",
Long: `Generate shell completion scripts for Distill CLI.
Bash:
$ distill completion bash > /etc/bash_completion.d/distill
Zsh:
$ distill completion zsh > "${fpath[1]}/_distill"
Fish:
$ distill completion fish > ~/.config/fish/completions/distill.fish
PowerShell:
PS> distill completion powershell | Out-String | Invoke-Expression`,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Args: cobra.ExactArgs(1),
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)
case "fish":
return rootCmd.GenFishCompletion(os.Stdout, true)
case "powershell":
return rootCmd.GenPowerShellCompletionWithDesc(os.Stdout)
}
return fmt.Errorf("unsupported shell: %s", args[0])
},
}Deliverables
-
cmd/completion.go- Completion command - README section with installation instructions per shell
- GoReleaser: include completion scripts in release archives
Acceptance Criteria
-
distill completion bashoutputs valid bash completion -
distill completion zshoutputs valid zsh completion - Tab-completing
distill se<TAB>yieldsserve - Flag completions work (e.g.,
distill api --p<TAB>yields--port)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request