clikt / com.github.ajalt.clikt.completion / CompletionCandidates / Custom

Custom

data class Custom : CompletionCandidates

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.

Types

Name Summary
ShellType enum class ShellType

Constructors

Name Summary
<init> Complete the parameter with words emitted from a custom script.Custom(generator: (ShellType) ->String?)

Properties

Name Summary
generator val generator: (ShellType) ->String?

Companion Object Functions

Name Summary
fromStdout fun fromStdout(command:String): Custom