completion

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "completion <shell>",
	Short: "Generate shell completion scripts",
	Long: `Generate shell completion scripts for hevycli.

Supported shells: bash, zsh, fish, powershell

To load completions:

Bash:
  $ source <(hevycli completion bash)

  # To load completions for each session, execute once:
  # Linux:
  $ hevycli completion bash > /etc/bash_completion.d/hevycli
  # macOS:
  $ hevycli completion bash > $(brew --prefix)/etc/bash_completion.d/hevycli

Zsh:
  # If shell completion is not already enabled in your environment,
  # you will need to enable it. You can execute the following once:
  $ echo "autoload -U compinit; compinit" >> ~/.zshrc

  # To load completions for each session, execute once:
  $ hevycli completion zsh > "${fpath[1]}/_hevycli"

  # You will need to start a new shell for this setup to take effect.

Fish:
  $ hevycli completion fish | source

  # To load completions for each session, execute once:
  $ hevycli completion fish > ~/.config/fish/completions/hevycli.fish

PowerShell:
  PS> hevycli completion powershell | Out-String | Invoke-Expression

  # To load completions for every new session, run:
  PS> hevycli completion powershell > hevycli.ps1
  # and source this file from your PowerShell profile.
`,
	DisableFlagsInUseLine: true,
	ValidArgs:             []string{"bash", "zsh", "fish", "powershell"},
	Args: func(cmd *cobra.Command, args []string) error {
		if len(args) == 0 {

			if cmdutil.IsInteractive() {
				return nil
			}
			return fmt.Errorf("please specify a shell: bash, zsh, fish, or powershell\n\nExample: hevycli completion bash")
		}
		if len(args) > 1 {
			return fmt.Errorf("only one shell can be specified at a time")
		}
		for _, valid := range []string{"bash", "zsh", "fish", "powershell"} {
			if args[0] == valid {
				return nil
			}
		}
		return fmt.Errorf("unknown shell %q\n\nSupported shells: bash, zsh, fish, powershell", args[0])
	},
	RunE: runCompletion,
}

Cmd is the completion command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL