# Class: CLI

## vertx-js/cli~ CLI

#### new CLI()

Interface defining a command-line interface (in other words a command such as 'run', 'ls'...). This interface is polyglot to ease reuse such as in Vert.x Shell.

A command line interface has a name, and defines a set of options and arguments. Options are key-value pair such

Source:
  - vertx-js/cli.js, line 34

### Methods

#### addArgument(arg) → {CLI}

Adds an argument.

##### Parameters:

Name | Type | Description
--- | --- | ---
`arg` | Object | the argument, must not be `null`

Source:
  - vertx-js/cli.js, line 253

##### Returns:

the current CLI instance

Type
  CLI

#### addArguments(args) → {CLI}

Adds a set of arguments. Unlike CLI#setArguments, this method does not remove the existing arguments. The given list is appended to the existing list.

##### Parameters:

Name | Type | Description
--- | --- | ---
`args` | Array.<Object> | the arguments, must not be `null`

Source:
  - vertx-js/cli.js, line 269

##### Returns:

the current CLI instance

Type
  CLI

#### addOption(option) → {CLI}

Adds an option.

##### Parameters:

Name | Type | Description
--- | --- | ---
`option` | Object | the option, must not be `null`.

Source:
  - vertx-js/cli.js, line 193

##### Returns:

the current CLI instance

Type
  CLI

#### addOptions(options) → {CLI}

Adds a set of options. Unlike CLI#setOptions}, this method does not remove the existing options. The given list is appended to the existing list.

##### Parameters:

Name | Type | Description
--- | --- | ---
`options` | Array.<Object> | the options, must not be `null`

Source:
  - vertx-js/cli.js, line 209

##### Returns:

the current CLI instance

Type
  CLI

#### getArgument(index) → {Object}

Gets an Argument based on its index.

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | number | the index, must be positive or zero.

Source:
  - vertx-js/cli.js, line 313

##### Returns:

the Argument, `null` if not found.

Type
  Object

#### getArguments() → {Array.<Object>}

Gets the list of defined arguments.

Source:
  - vertx-js/cli.js, line 239

##### Returns:

the list of argument, empty if none.

Type
  Array.<Object>

#### getDescription() → {string}

Source:
  - vertx-js/cli.js, line 92

##### Returns:

- the CLI description.
- Type
    string

#### getName() → {string}

Source:
  - vertx-js/cli.js, line 63

##### Returns:

- the CLI name.
- Type
    string

#### getOption(name) → {Object}

Gets an Option based on its name (short name, long name or argument name).

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | the name, must not be `null`

Source:
  - vertx-js/cli.js, line 299

##### Returns:

the Option, `null` if not found

Type
  Object

#### getOptions() → {Array.<Object>}

Gets the list of options.

Source:
  - vertx-js/cli.js, line 179

##### Returns:

the list of options, empty if none.

Type
  Array.<Object>

#### getSummary() → {string}

Source:
  - vertx-js/cli.js, line 120

##### Returns:

- the CLI summary.
- Type
    string

#### isHidden() → {boolean}

Checks whether or not the current CLI instance is hidden.

Source:
  - vertx-js/cli.js, line 149

##### Returns:

`true` if the current CLI is hidden, otherwise

Type
  boolean

#### parse(arguments, validate) → {CommandLine}

Parses the user command line interface and create a new CommandLine containing extracting values.

##### Parameters:

Name | Type | Description
--- | --- | ---
`arguments` | Array.<string> | the arguments
`validate` | boolean | enable / disable parsing validation

Source:
  - vertx-js/cli.js, line 47

##### Returns:

the creates command line

Type
  CommandLine

#### removeArgument(index) → {CLI}

Removes an argument identified by its index. This method does nothing if the argument cannot be found.

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | number | the argument index

Source:
  - vertx-js/cli.js, line 344

##### Returns:

the current CLI instance

Type
  CLI

#### removeOption(name) → {CLI}

Removes an option identified by its name. This method does nothing if the option cannot be found.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | the option name

Source:
  - vertx-js/cli.js, line 329

##### Returns:

the current CLI instance

Type
  CLI

#### setArguments(args) → {CLI}

Sets the list of arguments.

##### Parameters:

Name | Type | Description
--- | --- | ---
`args` | Array.<Object> | the list of arguments, must not be `null`

Source:
  - vertx-js/cli.js, line 284

##### Returns:

the current CLI instance

Type
  CLI

#### setDescription(desc) → {CLI}

##### Parameters:

Name | Type | Description
--- | --- | ---
`desc` | string |

Source:
  - vertx-js/cli.js, line 105

##### Returns:

Type
  CLI

#### setHidden(hidden) → {CLI}

Sets whether or not the current instance of CLI must be hidden. Hidden CLI are not listed when displaying usages / help messages. In other words, hidden commands are for power user.

##### Parameters:

Name | Type | Description
--- | --- | ---
`hidden` | boolean | enables or disables the hidden aspect of the CI

Source:
  - vertx-js/cli.js, line 164

##### Returns:

the current CLI instance

Type
  CLI

#### setName(name) → {CLI}

Sets the name of the CLI.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | the name

Source:
  - vertx-js/cli.js, line 77

##### Returns:

the current CLI instance

Type
  CLI

#### setOptions(options) → {CLI}

Sets the list of arguments.

##### Parameters:

Name | Type | Description
--- | --- | ---
`options` | Array.<Object> | the list of options, must not be `null`

Source:
  - vertx-js/cli.js, line 224

##### Returns:

the current CLI instance

Type
  CLI

#### setSummary(summary) → {CLI}

Sets the summary of the CLI.

##### Parameters:

Name | Type | Description
--- | --- | ---
`summary` | string | the summary

Source:
  - vertx-js/cli.js, line 134

##### Returns:

the current CLI instance

Type
  CLI