Package-level declarations

Types

Link copied to clipboard
class Abort(val error: Boolean = true) : RuntimeException

An internal error that signals Clikt to abort.

Link copied to clipboard

A parameter was given the correct number of values, but of invalid format or type.

Link copied to clipboard
abstract class CliktCommand(help: String = "", epilog: String = "", name: String? = null, val invokeWithoutSubcommand: Boolean = false, val printHelpOnEmptyArgs: Boolean = false, val helpTags: Map<String, String> = emptyMap(), autoCompleteEnvvar: String? = "", allowMultipleSubcommands: Boolean = false, treatUnknownOptionsAsArgs: Boolean = false, hidden: Boolean = false) : ParameterHolder

The CliktCommand is the core of command line interfaces in Clikt.

Link copied to clipboard
open class CliktError(message: String? = null, cause: Exception? = null) : RuntimeException

An exception during command line processing that should be shown to the user.

Link copied to clipboard
class Context @JvmOverloads constructor(val parent: Context?, val command: CliktCommand, val allowInterspersedArgs: Boolean, val autoEnvvarPrefix: String?, val printExtraMessages: Boolean, val helpOptionNames: Set<String>, val helpFormatter: HelpFormatter, val tokenTransformer: Context.(String) -> String, val console: CliktConsole, val expandArgumentFiles: Boolean, val readEnvvarBeforeValueSource: Boolean, val valueSource: ValueSource?, val correctionSuggestor: TypoSuggestor, val localization: Localization, val readEnvvar: (String) -> String? = ::readEnvvar, val originalArgv: List<String> = emptyList())

A object used to control command line parsing and pass data between commands.

Link copied to clipboard
class FileNotFound(filename: String, var context: Context? = null) : UsageError

A required configuration file was not found.

Link copied to clipboard

An option that can be added to a ParameterGroup

Link copied to clipboard
class IncorrectArgumentValueCount(var argument: Argument, var context: Context? = null) : UsageError

An argument was supplied but the number of values supplied was incorrect.

Link copied to clipboard
class IncorrectOptionValueCount(var option: Option, givenName: String, var context: Context? = null) : UsageError

An option was supplied but the number of values supplied to the option was incorrect.

Link copied to clipboard
class InvalidFileFormat(filename: String, message: String, lineno: Int? = null, var context: Context? = null) : UsageError

A configuration file failed to parse correctly

Link copied to clipboard
class MissingArgument(var argument: Argument, var context: Context? = null) : UsageError

A required argument was not provided

Link copied to clipboard
class MissingOption(var option: Option, var context: Context? = null) : UsageError

A required option was not provided

Link copied to clipboard
class MutuallyExclusiveGroupException(names: List<String>, var context: Context? = null) : UsageError
Link copied to clipboard
open class NoOpCliktCommand(help: String = "", epilog: String = "", name: String? = null, val invokeWithoutSubcommand: Boolean = false, val printHelpOnEmptyArgs: Boolean = false, val helpTags: Map<String, String> = emptyMap(), autoCompleteEnvvar: String? = "", allowMultipleSubcommands: Boolean = false, hidden: Boolean = false) : CliktCommand

A CliktCommand that has a default implementation of CliktCommand.run that is a no-op.

Link copied to clipboard
class NoSuchOption(givenName: String, possibilities: List<String> = emptyList(), var context: Context? = null) : NoSuchParameter

An option was provided that does not exist.

Link copied to clipboard

A parameter was provided that does not exist.

Link copied to clipboard
class NoSuchSubcommand(givenName: String, possibilities: List<String> = emptyList(), var context: Context? = null) : NoSuchParameter

A subcommand was provided that does not exist.

Link copied to clipboard
interface ParameterHolder
Link copied to clipboard
annotation class ParameterHolderDsl
Link copied to clipboard
class PrintCompletionMessage(message: String, val forceUnixLineEndings: Boolean) : PrintMessage

An exception that indicates that shell completion code should be printed.

Link copied to clipboard
class PrintHelpMessage(val command: CliktCommand, val error: Boolean = false) : CliktError

An exception that indicates that the command's help should be printed.

Link copied to clipboard
open class PrintMessage(message: String, val error: Boolean = false) : CliktError

An exception that indicates that a message should be printed.

Link copied to clipboard
class ProgramResult(val statusCode: Int) : CliktError

Indicate that that the program finished in a controlled manner, and should complete with the given statusCode

Link copied to clipboard
Link copied to clipboard
typealias TypoSuggestor = (enteredValue: String, possibleValues: List<String>) -> List<String>
Link copied to clipboard
open class UsageError : CliktError

An internal exception that signals a usage error.

Functions

Link copied to clipboard
fun <T : CliktCommand> T.context(block: Context.Builder.() -> Unit): T

Configure this command's Context.

Link copied to clipboard

Find the closest object of type T, or null

Link copied to clipboard
inline fun <T : Any> CliktCommand.findOrSetObject(crossinline default: () -> T): ReadOnlyProperty<CliktCommand, T>

Find the closest object of type T, setting context.obj if one is not found.

Link copied to clipboard

Find the closest object of type T, or throw a NullPointerException

Link copied to clipboard
fun <T : CliktCommand> T.subcommands(vararg commands: CliktCommand): T

Add the given commands as a subcommand of this command.