clikt / com.github.ajalt.clikt.core / UsageError

UsageError

open class UsageError : CliktError

An internal exception that signals a usage error.

The option and argument properties are used in message formatting, and can be set after the exception is created. If this is thrown inside a call to convert, the argument or option value will be set automatically

Constructors

<init>

UsageError(text: String, paramName: String? = null)
UsageError(text: String, argument: Argument)
UsageError(text: String, option: Option)

Properties

argument

var argument: Argument?

The argument that caused this error. This may be set after the error is thrown.

message

open val message: String?

option

var option: Option?

The option that caused this error. This may be set after the error is thrown.

paramName

var paramName: String?

The name of the parameter that caused the error. If possible, this should be set to the actual name used. If not set, it will be inferred from argument or option if either is set.

text

val text: String?

Extra text to add to the message. Not all subclasses uses this.

Functions

formatMessage

open fun formatMessage(): String

helpMessage

fun helpMessage(context: Context? = null): String

inferParamName

fun inferParamName(): String

Inheritors

BadParameterValue

open class BadParameterValue : UsageError

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

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.