autocomplete

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AutoCompleteCmd = &cobra.Command{
	Use:   fmt.Sprintf("autocomplete [%s]", strings.Join(supportedShells, "|")),
	Short: "Adds a completion script for your shell environment",
	Args:  cobra.ExactArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {
		shell := args[0]

		profilePath, err := SetupAutocompletionForShell(cmd.Root(), shell)
		if err != nil {
			return err
		}

		fmt.Println("Autocomplete script generated and injected successfully.")
		fmt.Printf("Please source your %s profile to apply the changes or restart your terminal.\n", shell)
		fmt.Printf("For manual sourcing, use: source %s\n", profilePath)
		if shell == "bash" {
			fmt.Println("Please make sure that you have bash-completion installed in order to get full autocompletion functionality.")
			fmt.Println("On how to install bash-completion, please refer to the following link: https://www.daytona.io/docs/tools/cli/#daytona-autocomplete")
		}

		return nil
	},
}

Functions

func DetectShellAndSetupAutocompletion

func DetectShellAndSetupAutocompletion(rootCmd *cobra.Command) error

func SetupAutocompletionForShell

func SetupAutocompletionForShell(rootCmd *cobra.Command, shell string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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