completion

package
v0.0.0-...-6c7f99c Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ShellCompNoDescRequestCmd is the name of the hidden command that is used to request
	// completion results without their description.  It is used by the shell completion scripts.
	ShellCompNoDescRequestCmd = "completion completeNoDesc"
	BashCompFilenameExt       = "kong_annotation_bash_completion_filename_extensions"
	BashCompCustom            = "kong_annotation_bash_completion_custom"
	BashCompOneRequiredFlag   = "kong_annotation_bash_completion_one_required_flag"
	BashCompSubdirsInDir      = "kong_annotation_bash_completion_subdirs_in_dir"
)

Annotations for Bash completion.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bash

type Bash struct{}

Bash is a bash completion generator.

func (Bash) Run

func (b Bash) Run(ctx *kong.Context) error

Run generates bash completion script.

type Completion

type Completion struct {
	Bash Bash `cmd:"" help:"Generate the autocompletion script for bash"`
	Zsh  Zsh  `cmd:"" help:"Generate the autocompletion script for zsh"`
	Fish Fish `cmd:"" help:"Generate the autocompletion script for fish"`
}

Completion command.

type Fish

type Fish struct{}

Fish is a fish shell completion generator.

func (Fish) Run

func (f Fish) Run(ctx *kong.Context) error

Run generates fish completion script.

type ShellCompDirective

type ShellCompDirective int

ShellCompDirective is a bit map representing the different behaviors the shell can be instructed to have once completions have been provided.

const (
	// ShellCompDirectiveError indicates an error occurred and completions should be ignored.
	ShellCompDirectiveError ShellCompDirective = 1 << iota

	// ShellCompDirectiveNoSpace indicates that the shell should not add a space
	// after the completion even if there is a single completion provided.
	ShellCompDirectiveNoSpace

	// ShellCompDirectiveNoFileComp indicates that the shell should not provide
	// file completion even when no completion is provided.
	ShellCompDirectiveNoFileComp

	// ShellCompDirectiveFilterFileExt indicates that the provided completions
	// should be used as file extension filters.
	// For flags, using Command.MarkFlagFilename() and Command.MarkPersistentFlagFilename()
	// is a shortcut to using this directive explicitly.  The BashCompFilenameExt
	// annotation can also be used to obtain the same behavior for flags.
	ShellCompDirectiveFilterFileExt

	// ShellCompDirectiveFilterDirs indicates that only directory names should
	// be provided in file completion.  To request directory names within another
	// directory, the returned completions should specify the directory within
	// which to search.  The BashCompSubdirsInDir annotation can be used to
	// obtain the same behavior but only for flags.
	ShellCompDirectiveFilterDirs

	// ShellCompDirectiveDefault indicates to let the shell perform its default
	// behavior after completions have been provided.
	// This one must be last to avoid messing up the iota count.
	ShellCompDirectiveDefault ShellCompDirective = 0
)

type Zsh

type Zsh struct{}

Zsh is zsh completion generator.

func (Zsh) Run

func (z Zsh) Run(ctx *kong.Context) error

Run generates zsh completion script.

Jump to

Keyboard shortcuts

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