Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CompletionCommand = redant.Command{ Use: "completion [shell]", Short: "Generate the autocompletion script for the specified shell", Long: `Generate the autocompletion script for redant for the specified shell. See each sub-command's help for details on how to use the generated script.`, Handler: func(ctx context.Context, inv *redant.Invocation) error { if len(inv.Args) == 0 { fmt.Fprintf(inv.Stderr, "error: shell argument is required. Available shells: bash, zsh, fish\n") return fmt.Errorf("missing shell argument") } shell := inv.Args[0] switch shell { case "bash": return generateBashCompletion(ctx, inv) case "zsh": return generateZshCompletion(ctx, inv) case "fish": return generateFishCompletion(ctx, inv) default: fmt.Fprintf(inv.Stderr, "error: unsupported shell: %s. Available shells: bash, zsh, fish\n", shell) return fmt.Errorf("unsupported shell: %s", shell) } }, }
CompletionCommand is a built-in command for generating shell completion scripts
Functions ¶
func AddCompletionCommand ¶
AddCompletionCommand adds the completion command to the root command
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.