Arguments

class Arguments(indexedArguments: List<String>, namedArguments: Map<String, String>)

Representation of the Argument Manager. This class is used to get a given argument in a command executor

Parameters

indexedArguments

The list of arguments

How to retrieve a value:

val name = args.get<Type>(index) // The type is the object type that you expect to receive, the index is the index of the argument.
val lastname = args.get<Type>(name) // The type is the object type that you expect to receive, the name is the name of the argument.

Constructors

Link copied to clipboard
fun Arguments(indexedArguments: List<String> = emptyList(), namedArguments: Map<String, String> = emptyMap())

Functions

Link copied to clipboard
inline fun <T> get(index: Int): T?

Gets the value of an argument by index

inline fun <T> get(name: String): T?

Gets the value of an argument by name

Link copied to clipboard
fun has(index: Int): Boolean

Checks if there is an argument under the given index

fun has(name: String): Boolean

Checks if there is an argument under the given name

Link copied to clipboard
fun isEmpty(): Boolean

Checks if there are no arguments

Link copied to clipboard
fun isNotEmpty(): Boolean

Checks if there is at least one argument

Link copied to clipboard
inline fun <T> isValid(index: Int): Boolean

Checks if the value of an argument is valid by index

inline fun <T> isValid(name: String): Boolean

Checks if the value of an argument is valid by name

Properties

Link copied to clipboard
val indexedArguments: List<String>
Link copied to clipboard
val namedArguments: Map<String, String>