Skip to content

cli::addArgument

addArgument(parser: CliParser, argument: Dictionary)

ParameterTypeDescription
parserCliParserThe parser to add it to
argumentDictionaryA dictionary such as the one in the example below

Adds an argument to the given parser.

Returns

(*) The parser that was given.

Example

elk
parser | cli::addArgument({
     "identifier": "test-argument",
     "description": "Some description",
     "required": true,
     "variadic": true,
 })

 # Default values for the argument object
 {
     "identifier": nil, # Identifier used to later get the value of the argument
     "description": nil, # A description of the argument
     "required": false, # Whether or not the argument is required
     "variadic": false, # Whether or not the argument may consist of several tokens
     "valueKind": "none", # "none", "path", "directory" or "text"
     "completionHandler": nil, # A function used for custom completions
     "allowCustomCompletionHints": false, # Whether or not hints should be displayed for custom completions
 }
parser | cli::addArgument({
     "identifier": "test-argument",
     "description": "Some description",
     "required": true,
     "variadic": true,
 })

 # Default values for the argument object
 {
     "identifier": nil, # Identifier used to later get the value of the argument
     "description": nil, # A description of the argument
     "required": false, # Whether or not the argument is required
     "variadic": false, # Whether or not the argument may consist of several tokens
     "valueKind": "none", # "none", "path", "directory" or "text"
     "completionHandler": nil, # A function used for custom completions
     "allowCustomCompletionHints": false, # Whether or not hints should be displayed for custom completions
 }