completion

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CompletionCmd = &cobra.Command{
	Use:   "completion [bash|zsh|fish|powershell]",
	Short: "Generate shell completion scripts",
	Long: `Generate shell completion scripts for playconsole-cli.

To load completions:

Bash:
  $ source <(gpc completion bash)

  # To load for each session (Linux):
  $ gpc completion bash > /etc/bash_completion.d/gpc

  # To load for each session (macOS):
  $ gpc completion bash > $(brew --prefix)/etc/bash_completion.d/gpc

Zsh:
  # If shell completion is not already enabled, enable it:
  $ echo "autoload -U compinit; compinit" >> ~/.zshrc

  $ source <(gpc completion zsh)

  # To load for each session:
  $ gpc completion zsh > "${fpath[1]}/_gpc"

Fish:
  $ gpc completion fish | source

  # To load for each session:
  $ gpc completion fish > ~/.config/fish/completions/gpc.fish

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

  # To load for each session:
  PS> gpc completion powershell > gpc.ps1
  # and source this file from your PowerShell profile.
`,
	DisableFlagsInUseLine: true,
	ValidArgs:             []string{"bash", "zsh", "fish", "powershell"},
	Args:                  cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
	RunE: func(cmd *cobra.Command, args []string) error {
		switch args[0] {
		case "bash":
			return cmd.Root().GenBashCompletion(os.Stdout)
		case "zsh":
			return cmd.Root().GenZshCompletion(os.Stdout)
		case "fish":
			return cmd.Root().GenFishCompletion(os.Stdout, true)
		case "powershell":
			return cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout)
		}
		return nil
	},
}

CompletionCmd generates shell completion scripts

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