Package-level declarations

Types

Link copied to clipboard

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, val statusCode: Int = 1, val printError: Boolean = true) : RuntimeException

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

Link copied to clipboard
class Context

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

Link copied to clipboard

An interface for CliktErrors that have a context attached

Link copied to clipboard
class FileNotFound(val filename: String) : 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(val nvalues: Int, argument: Argument) : UsageError

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

Link copied to clipboard
class IncorrectOptionValueCount(minValues: Int, var paramName: String) : 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) : UsageError

A configuration file failed to parse correctly

Link copied to clipboard

A required argument was not provided

Link copied to clipboard

A required option was not provided

Link copied to clipboard

Multiple usage errors occurred.

Link copied to clipboard

Multiple mutually exclusive options were supplied.

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(var paramName: String, possibilities: List<String> = emptyList()) : UsageError

An option was provided that does not exist.

Link copied to clipboard
class NoSuchSubcommand(var paramName: String, possibilities: List<String> = emptyList()) : UsageError

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

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

Link copied to clipboard
class PrintHelpMessage(var context: Context?, val error: Boolean = false, val statusCode: Int = 0) : CliktError, ContextCliktError

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

Link copied to clipboard
open class PrintMessage(message: String, val statusCode: Int = 0, val printError: Boolean = false) : CliktError

An exception that indicates that a message should be printed.

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

Indicate 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(message: String?, var paramName: String? = null, val statusCode: Int = 1) : CliktError, ContextCliktError

An exception that signals a user error.

Properties

Link copied to clipboard
val CliktCommand.terminal: Terminal

A short for accessing the terminal from the currentContext

Link copied to clipboard
val Context.theme: Theme

The current terminal's theme

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.