clikt / com.github.ajalt.clikt.completion / CompletionCandidates / 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.


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.


Name Summary
ShellType enum class ShellType


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


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

Companion Object Functions

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