completion

package
v1.2.45-rc3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "completion",
	Short: "Generates completion scripts",
	Long: `To load completions:

Bash:

  $ source <(rosa completion bash)

  # To load completions for each session, execute once:
  # Linux:
  $ rosa completion bash > /etc/bash_completion.d/rosa
  # macOS:
  $ rosa completion bash > /usr/local/etc/bash_completion.d/rosa

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:
  $ rosa completion zsh > "${fpath[1]}/_rosa"

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

fish:

  $ rosa completion fish | source

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

PowerShell:

  PS> rosa completion powershell | Out-String | Invoke-Expression

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

			cmd.Root().GenBashCompletion(os.Stdout)
			return
		}
		switch args[0] {
		case "bash":
			cmd.Root().GenBashCompletion(os.Stdout)
		case "zsh":
			cmd.Root().GenZshCompletion(os.Stdout)
		case "fish":
			cmd.Root().GenFishCompletion(os.Stdout, true)
		case "powershell":
			cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout)
		}
	},
}

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