Help us shape the future of Go! Take the 2026 Go Developer Survey

autocomplete

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShellCompletionBehaviorDefault    ShellCompletionBehavior = iota
	ShellCompletionBehaviorFile                               = 10
	ShellCompletionBehaviorNoComplete                         = 11
)

Variables

This section is empty.

Functions

func ExecuteShellCompletion

func ExecuteShellCompletion(ctx context.Context, cmd *cli.Command) error

func FishPackagePickerScript added in v1.37.0

func FishPackagePickerScript() ([]byte, error)

FishPackagePickerScript renders the Linux package's vendor_conf.d script. It checks consent at activation and the selected executable at every Tab press.

func IsPickerInstalled added in v1.36.0

func IsPickerInstalled(ctx context.Context, options PickerInstallation) (bool, error)

IsPickerInstalled verifies an intact profile block and an owned script that matches this CLI's current content, without creating files or locking.

func OutputCompletionScript

func OutputCompletionScript(ctx context.Context, cmd *cli.Command) error

func WithPickerSetupLock added in v1.36.0

func WithPickerSetupLock(ctx context.Context, directory string, change func() error) error

WithPickerSetupLock serializes a command's complete setup decision, including all startup profiles and its opt-out preference. Its lock is distinct from the per-file transaction locks used by InstallPicker and RemovePicker.

Types

type CompletionResult

type CompletionResult struct {
	Completions []ShellCompletion
	Behavior    ShellCompletionBehavior
}

func GetCompletions

func GetCompletions(completionStyle CompletionStyle, root *cli.Command, args []string) CompletionResult

type CompletionStyle

type CompletionStyle string
const (
	CompletionStyleZsh        CompletionStyle = "zsh"
	CompletionStyleBash       CompletionStyle = "bash"
	CompletionStylePowershell CompletionStyle = "pwsh"
	CompletionStyleFish       CompletionStyle = "fish"
)

type PickerInstallResult added in v1.36.0

type PickerInstallResult struct {
	Changed    bool
	ScriptPath string
}

func InstallPicker added in v1.36.0

func InstallPicker(ctx context.Context, options PickerInstallation) (PickerInstallResult, error)

InstallPicker persists normal completion and the optional picker hook. The immutable script is committed before the profile; failed profile updates preserve scripts needed by an interrupted profile transaction. Cooperating writers serialize from validation through recovery. External editors do not share these locks: displaced profiles are retained, and publication never replaces an entry created by an editor during the transaction.

func RemovePicker added in v1.36.0

func RemovePicker(ctx context.Context, options PickerInstallation) (PickerInstallResult, error)

RemovePicker removes only an intact managed block and its verified script. Modified blocks or scripts are preserved and reported for manual inspection.

type PickerInstallation added in v1.36.0

type PickerInstallation struct {
	Shell      CompletionStyle
	Directory  string
	Profile    string
	OptOutPath string // Optional shared marker for managed fish activation.
}

PickerInstallation contains only caller-selected paths. Shell discovery and consent belong to the command layer. Profile must be the startup file that this shell actually reads.

type ShellCompletion

type ShellCompletion struct {
	Name  string
	Usage string
}

func NewShellCompletion

func NewShellCompletion(name string, usage string) ShellCompletion

type ShellCompletionBehavior

type ShellCompletionBehavior int

Jump to

Keyboard shortcuts

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