Package com.github.ajalt.clikt.core

Types

Link copied to clipboard
class Abort(error: Boolean)

An internal error that signals Clikt to abort.

Link copied to clipboard
class BadParameterValue : UsageError

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?, invokeWithoutSubcommand: Boolean, printHelpOnEmptyArgs: Boolean, helpTags: Map<String, String>, autoCompleteEnvvar: String?, allowMultipleSubcommands: Boolean, treatUnknownOptionsAsArgs: Boolean) : ParameterHolder

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

Link copied to clipboard
open class CliktError(message: String?, cause: <ERROR CLASS>?)

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

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

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

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

A required configuration file was not found.

Link copied to clipboard
interface GroupableOption : StaticallyGroupedOption

An option that can be added to a ParameterGroup

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

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

Link copied to clipboard
class IncorrectOptionValueCount(option: Option, givenName: String, context: Context?) : 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?, context: Context?) : UsageError

A configuration file failed to parse correctly

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

A required argument was not provided

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

A required option was not provided

Link copied to clipboard
class MutuallyExclusiveGroupException(names: List<String>, context: Context?) : UsageError
Link copied to clipboard
open class NoOpCliktCommand(help: String, epilog: String, name: String?, invokeWithoutSubcommand: Boolean, printHelpOnEmptyArgs: Boolean, helpTags: Map<String, String>, autoCompleteEnvvar: String?, allowMultipleSubcommands: Boolean) : 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>, context: Context?) : NoSuchParameter

An option was provided that does not exist.

Link copied to clipboard
open class NoSuchParameter : UsageError

A parameter was provided that does not exist.

Link copied to clipboard
class NoSuchSubcommand(givenName: String, possibilities: List<String>, context: Context?) : 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, forceUnixLineEndings: Boolean) : PrintMessage

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

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

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

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

An exception that indicates that a message should be printed.

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

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

Link copied to clipboard
interface StaticallyGroupedOption : Option
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
inline fun <T : Any> CliktCommand.findObject(): <ERROR CLASS><CliktCommand, T?>

Find the closest object of type T, or null

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

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

Link copied to clipboard
inline fun <T : Any> CliktCommand.requireObject(): <ERROR CLASS><CliktCommand, T>

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

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

Add the given commands as a subcommand of this command.