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 BaseCliktCommand<T : BaseCliktCommand<T>>(name: String? = null) : ParameterHolder

A base class for commands that want to define a custom type for their run function.

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
abstract class CoreCliktCommand(name: String? = null) : BaseCliktCommand<CoreCliktCommand>

A command with a run function that's called when the command is invoked.

Link copied to clipboard
open class CoreNoOpCliktCommand(name: String? = null) : CoreCliktCommand

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

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
typealias MessageEchoer = (context: Context, message: Any?, trailingNewline: Boolean, err: Boolean) -> Unit
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
class NoSuchArgument(excessArguments: List<String>) : UsageError

One or more arguments were provided that do not exist.

Link copied to clipboard
class NoSuchOption @JvmOverloads constructor(var paramName: String, possibilities: List<String> = emptyList(), subcommand: String? = null) : 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

Set an arbitrary object on the context.

Functions

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

Configure this command's Context.

Link copied to clipboard
inline fun <T : Any> BaseCliktCommand<*>.findObject(key: String = Context.DEFAULT_OBJ_KEY): ReadOnlyProperty<BaseCliktCommand<*>, T?>

Find the closest object of type T, or null

Link copied to clipboard
inline fun <T : Any> BaseCliktCommand<*>.findOrSetObject(key: String = Context.DEFAULT_OBJ_KEY, crossinline default: () -> T): ReadOnlyProperty<BaseCliktCommand<*>, T>

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

Link copied to clipboard

Parse the command line and print helpful output if any errors occur.

Link copied to clipboard

Parse the command line and throw an exception if parsing fails.

Link copied to clipboard

Register an AutoCloseable to be closed when this command and all its subcommands have finished running.

Link copied to clipboard

Register an AutoCloseable to be closed when this command and all its subcommands have finished running.

Link copied to clipboard
inline fun <T : Any> BaseCliktCommand<*>.requireObject(key: String = Context.DEFAULT_OBJ_KEY): ReadOnlyProperty<BaseCliktCommand<*>, T>

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

Link copied to clipboard
fun <T : BaseCliktCommand<T>, CommandT : T> CommandT.subcommands(vararg commands: T): CommandT

Add the given commands as a subcommand of this command.