Custom

Complete the parameter with words emitted from a custom script.

The generator takes the type of shell to generate a script for and returns code to add to the generated completion script. If you just want to call another script or binary that prints all possible completion words to stdout, you can use fromStdout.

Bash/ZSH

Both Bash and ZSH scripts use Bash's Programmable Completion system (ZSH via a comparability layer). The string returned from generator should be the body of a function that will be passed to compgen -F.

Specifically, you should set the variable COMPREPLY to the completion(s) for the current word being typed. The word being typed can be retrieved from the COMP_WORDS array at index COMP_CWORD.

Fish

The string returned from generator should be a Fish string with each completion suggestion separated by a newline. Each completion can optionally end with a tab, followed by a description of the suggestion.

"""'
start
stop
help\\t"show the help for this command"
test\\t"run test suite"
'"""

You can also construct the string from a fish command or function call, e.g.

"\"(__fish_print_hostnames)\""

or

"\"(ls -1)\""

Constructors

Link copied to clipboard
constructor(generator: (CompletionCandidates.Custom.ShellType) -> String?)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard