Movatterモバイル変換


[0]ホーム

URL:


ffcomplete

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:11Imported by:1

Details

Repository

github.com/tailscale/tailscale

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

View Source
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

func Inject(root *ffcli.Command, hide func(*ffcli.Command), usageFunc func(*ffcli.Command)string)

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.

funcLastArg

func LastArg(args []string)string

LastArg returns the last element of args, or the empty string if args isempty.

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

Source Files

View all Source files

Directories

PathSynopsis
Package internal contains internal code for the ffcomplete package.
Package internal contains internal code for the ffcomplete package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp