completion
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
README¶
completion
Thecompletion
package extendsserpent
to allow applications to generate rich auto-completions.
Protocol
The completion scripts call out to the serpent command to generatecompletions. The convention is to pass the exact args and flags (orcmdline) of the in-progress command with aCOMPLETION_MODE=1
environment variable. That environment variable lets the command know to generate completions instead of running the command.By default, completions will be generated based on available flags and subcommands. Additional completions can be added by supplying aCompletionHandlerFunc
on an Option or Command.
Documentation¶
Index¶
- Constants
- func FileHandler(filter func(info os.FileInfo) bool) serpent.CompletionHandlerFunc
- func InstallShellCompletion(shell Shell) error
- func ShellOptions(choice *string) *serpent.Enum
- type Shell
- func Bash(goos string, programName string) Shell
- func DetectUserShell(programName string) (Shell, error)
- func Fish(goos string, programName string) Shell
- func Powershell(goos string, programName string) Shell
- func ShellByName(shell, programName string) (Shell, error)
- func Zsh(goos string, programName string) Shell
Constants¶
const (ShellBashstring = "bash"ShellFishstring = "fish"ShellZshstring = "zsh"ShellPowershellstring = "powershell")
Variables¶
This section is empty.
Functions¶
funcFileHandler¶
func FileHandler(filter func(infoos.FileInfo)bool)serpent.CompletionHandlerFunc
FileHandler returns a handler that completes file names, using thegiven filter func, which may be nil.
funcShellOptions¶
Types¶
typeShell¶
type Shell interface {Name()stringInstallPath() (string,error)WriteCompletion(io.Writer)errorProgramName()string}