Skip to content

Commit f6ab999

Browse files
neongreenclaude
andcommitted
conf: Make eval the recommended completion installation method
Changes: - Removed all stderr output from completion command for clean eval - Updated help text to recommend eval method as primary approach - Kept file-based installation as alternative option Help now shows: Quick setup (recommended): # Zsh - add to ~/.zshrc eval "$(conf completion zsh)" Persistent installation (alternative): conf completion zsh > ~/.oh-my-zsh/completions/_conf Benefits: - Silent output when eval-ed (no comments/messages) - Simpler setup for users - Works immediately without file management - Still supports file-based installation for those who prefer it 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fdb30c3 commit f6ab999

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

conf/cmd/main.go

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -572,47 +572,45 @@ var completionCmd = &cobra.Command{
572572
Long: `Generate shell completion scripts with intelligent schema-aware suggestions.
573573
574574
The completion system provides:
575-
- Configuration path completion from actual schemas
575+
- Configuration path completion from actual schemas
576576
- Type-aware value suggestions (boolean, enum, etc.)
577577
- Current value display for existing settings
578578
- Descriptions for all configuration options
579579
580-
Installation:
580+
Quick setup (recommended):
581+
# Bash - add to ~/.bashrc
582+
eval "$(conf completion bash)"
583+
584+
# Zsh - add to ~/.zshrc
585+
eval "$(conf completion zsh)"
586+
587+
# Fish - add to ~/.config/fish/config.fish
588+
conf completion fish | source
589+
590+
Persistent installation (alternative):
581591
# Bash
582-
conf completion bash > /etc/bash_completion.d/conf
583-
# or for user-only:
584592
conf completion bash > ~/.local/share/bash-completion/completions/conf
585593
586-
# Zsh
594+
# Zsh
587595
conf completion zsh > ~/.oh-my-zsh/completions/_conf
588-
# or add to fpath and autoload
589596
590597
# Fish
591598
conf completion fish > ~/.config/fish/completions/conf.fish
592599
593-
Then restart your shell or source the completion file.`,
600+
After adding to your shell config, restart your shell or source the file.`,
594601
Args: cobra.ExactArgs(1),
595602
Run: func(cmd *cobra.Command, args []string) {
596603
shell := args[0]
597604
switch shell {
598605
case "bash":
599-
fmt.Fprintf(os.Stderr, "# conf schema-aware completion for bash\n")
600-
fmt.Fprintf(os.Stderr, "# Generated by: conf completion bash\n")
601-
fmt.Fprintf(os.Stderr, "# Install with: conf completion bash > ~/.local/share/bash-completion/completions/conf\n\n")
602606
rootCmd.GenBashCompletion(os.Stdout)
603607
case "zsh":
604-
fmt.Fprintf(os.Stderr, "# conf schema-aware completion for zsh\n")
605-
fmt.Fprintf(os.Stderr, "# Generated by: conf completion zsh\n")
606-
fmt.Fprintf(os.Stderr, "# Install with: conf completion zsh > ~/.oh-my-zsh/completions/_conf\n\n")
607608
rootCmd.GenZshCompletion(os.Stdout)
608609
case "fish":
609-
fmt.Fprintf(os.Stderr, "# conf schema-aware completion for fish\n")
610-
fmt.Fprintf(os.Stderr, "# Generated by: conf completion fish\n")
611-
fmt.Fprintf(os.Stderr, "# Install with: conf completion fish > ~/.config/fish/completions/conf.fish\n\n")
612610
rootCmd.GenFishCompletion(os.Stdout, true)
613611
default:
614-
fmt.Printf("Unsupported shell: %s\n", shell)
615-
fmt.Println("\nSupported shells: bash, zsh, fish")
612+
fmt.Fprintf(os.Stderr, "Unsupported shell: %s\n", shell)
613+
fmt.Fprintln(os.Stderr, "\nSupported shells: bash, zsh, fish")
616614
os.Exit(1)
617615
}
618616
},

0 commit comments

Comments
 (0)