ArgumentTransformContext

class ArgumentTransformContext(val argument: Argument, val context: Context) : Argument, TransformContext

A receiver for argument transformers.

Constructors

Link copied to clipboard
constructor(argument: Argument, context: Context)

Properties

Link copied to clipboard

The argument that was invoked

Link copied to clipboard

Optional set of strings to use when the user invokes shell autocomplete on a value for this argument.

Link copied to clipboard
open override val context: Context

The current context object

Link copied to clipboard
open override val helpTags: Map<String, String>

Extra information about this argument to pass to the help formatter.

Link copied to clipboard
open override val name: String

The metavar for this argument.

Link copied to clipboard
open override val nvalues: Int

The number of values that this argument takes.

Link copied to clipboard
open override val required: Boolean

If true, an error will be thrown if this argument is not given on the command line.

Link copied to clipboard

The terminal for the current context

Link copied to clipboard

The theme for the current context

Functions

Link copied to clipboard
open override fun fail(message: String): Nothing

Throw an exception indicating that usage was incorrect.

Link copied to clipboard
open override fun finalize(context: Context, values: List<String>)

Called after this command's argv is parsed to transform and store the argument's value.

Link copied to clipboard
open override fun getArgumentHelp(context: Context): String

The description of this argument.

Link copied to clipboard

Issue a message that can be shown to the user

Link copied to clipboard

Information about this argument for the help output.

Link copied to clipboard
open override fun postValidate(context: Context)

Called after all of a command's parameters have been finalized to perform validation of the final value.

Link copied to clipboard
inline fun require(value: Boolean, lazyMessage: () -> String = { "" })

If value is false, call fail with the output of lazyMessage