clikt / com.github.ajalt.clikt.core

Package com.github.ajalt.clikt.core

Types

CliktCommand

abstract class CliktCommand

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

Context

class Context

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

NoRunCliktCommand

open class NoRunCliktCommand : CliktCommand

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

Exceptions

Abort

class Abort : RuntimeException

An internal error that signals Clikt to abort.

BadParameterValue

open class BadParameterValue : UsageError

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

CliktError

open class CliktError : RuntimeException

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

IncorrectArgumentValueCount

open class IncorrectArgumentValueCount : UsageError

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

IncorrectOptionValueCount

open class IncorrectOptionValueCount : UsageError

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

MissingParameter

open class MissingParameter : UsageError

A required parameter was not provided

NoSuchOption

open class NoSuchOption : UsageError

An option was provided that does not exist.

PrintHelpMessage

class PrintHelpMessage : CliktError

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

PrintMessage

class PrintMessage : CliktError

An exception that indicates that a message should be printed.

UsageError

open class UsageError : CliktError

An internal exception that signals a usage error.

Functions

context

fun <T : CliktCommand> T.context(block: Builder.() -> Unit): T

Configure this command's Context.

findObject

fun <T : Any> CliktCommand.findObject(): ReadOnlyProperty<CliktCommand, T?>

Find the closest object of type T, or null

fun <T : Any> CliktCommand.findObject(default: () -> T): ReadOnlyProperty<CliktCommand, T>

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

requireObject

fun <T : Any> CliktCommand.requireObject(): ReadOnlyProperty<CliktCommand, T>

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

subcommands

fun <T : CliktCommand> T.subcommands(commands: Iterable<CliktCommand>): T
fun <T : CliktCommand> T.subcommands(vararg commands: CliktCommand): T

Add the given commands as a subcommand of this command.