ffcomplete
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
Documentation¶
Overview¶
Package ffcomplete provides shell tab-completion of subcommands, flags andarguments for Go programs written withffcli.
The shell integration scripts have been extracted from Cobra(https://cobra.dev/), whose authors deserve most of the credit for this work.These shell completion functions invoke `$0 completion __complete -- ...`which is wired up to [Complete].
Index¶
Constants¶
const (ShellCompDirectiveError =cobra.ShellCompDirectiveErrorShellCompDirectiveNoSpace =cobra.ShellCompDirectiveNoSpaceShellCompDirectiveNoFileComp =cobra.ShellCompDirectiveNoFileCompShellCompDirectiveFilterFileExt =cobra.ShellCompDirectiveFilterFileExtShellCompDirectiveFilterDirs =cobra.ShellCompDirectiveFilterDirsShellCompDirectiveKeepOrder =cobra.ShellCompDirectiveKeepOrderShellCompDirectiveDefault =cobra.ShellCompDirectiveDefault)
Variables¶
This section is empty.
Functions¶
funcArgs¶
func Args(cmd *ffcli.Command, compCompleteFunc)
Args registers a completion function for the args of cmd.
comp will be called to return suggestions when the user tries to tab-complete`prog <TAB>` or `prog subcmd arg1 <TAB>`, for example.
funcFlag¶
func Flag(fs *flag.FlagSet, namestring, compCompleteFunc)
Flag registers a completion function for the flag in fs with given name.comp will always called with a 1-element slice.
comp will be called to return suggestions when the user tries to tab-complete'--name=<TAB>' or '--name <TAB>' for the commands using fs.
funcInject¶
Inject adds the 'completion' subcommand to the root command which provide theuser with shell scripts for calling `completion __command` to providetab-completion suggestions.
root.Name needs to match the command that the user is tab-completing for theshell script to work as expected by default.
The hide function is called with the __complete Command instance to provide ahook to omit it from the help output, if desired.
Types¶
typeCompleteFunc¶
type CompleteFunc =internal.CompleteFunc
CompleteFunc is used to return tab-completion suggestions to the user as theyare typing command-line instructions. It returns the list of things tosuggest and an additional directive to the shell about what extrafunctionality to enable.
funcFilesWithExtensions¶
func FilesWithExtensions(exts ...string)CompleteFunc
FilesWithExtensions returns a CompleteFunc that tells the shell to limit filesuggestions to those with the given extensions.
funcFixed¶
func Fixed(words ...string)CompleteFunc
Fixed returns a CompleteFunc which suggests the given words.
typeShellCompDirective¶
type ShellCompDirective =cobra.ShellCompDirective