clikt / com.github.ajalt.clikt.core / NoRunCliktCommand

NoRunCliktCommand

open class NoRunCliktCommand : CliktCommand

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

Constructors

<init>

NoRunCliktCommand(help: String = "", epilog: String = "", name: String? = null)

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

Inherited Properties

commandHelp

val commandHelp: String

commandHelpEpilog

val commandHelpEpilog: String

commandName

val commandName: String

context

val context: Context

This command's context.

invokeWithoutSubcommand

val invokeWithoutSubcommand: Boolean

Used when this command has subcommands, and this command is called without a subcommand. If true, run will be called. By default, a PrintHelpMessage is thrown instead.

Functions

run

open fun run(): Unit

Perform actions after parsing is complete and this command is invoked.

Inherited Functions

aliases

open fun aliases(): Map<String, List<String>>

A list of command aliases.

getFormattedHelp

open fun getFormattedHelp(): String

Return the full help string for this command.

getFormattedUsage

open fun getFormattedUsage(): String

Return the usage string for this command.

main

fun main(argv: Array<String>): Unit

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

parse

fun parse(argv: Array<String>, context: Context? = null): Unit

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

registerArgument

fun registerArgument(argument: Argument): Unit

Register an argument with this command.

registerOption

fun registerOption(option: Option): Unit

Register an option with this command.

registeredSubcommandNames

fun registeredSubcommandNames(): List<String>

The names of all direct children of this command

shortHelp

fun shortHelp(): String

The help displayed in the commands list when this command is used as a subcommand.

Extension Functions

argument

fun CliktCommand.argument(name: String = "", help: String = ""): RawArgument

Create a property delegate argument.

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.

option

fun CliktCommand.option(vararg names: String, help: String = "", metavar: String? = null, hidden: Boolean = false, envvar: String? = null): RawOption

Create a property delegate option.

requireObject

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

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