Package: io.vertx.groovy.core.cli

## [Groovy] Class CLI

- io.vertx.groovy.core.cli.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 as `-foo=bar` or `-flag`. The supported formats depend on the used parser. Arguments are unlike options raw values. Options are defined using Option, while argument are defined using Argument.

  Command line interfaces also define a summary and a description. These attributes are used in the usage generation . To disable the help generation, set the `hidden` attribute to `true`.

  Command Line Interface object does not contains "value", it's a model. It must be evaluated by a parser that returns a CommandLine object containing the argument and option values.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `CLI (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `CLI` | `addArgument(java.util.Map<java.lang.String, java.lang.Object> arg = [:])` Adds an argument.
    `CLI` | `addArguments(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> args)` Adds a set of arguments.
    `CLI` | `addOption(java.util.Map<java.lang.String, java.lang.Object> option = [:])` Adds an option.
    `CLI` | `addOptions(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> options)` Adds a set of options.
    `static CLI` | `create(java.lang.String name)` Creates an instance of CLI using the default implementation.
    `java.util.Map<java.lang.String, java.lang.Object>` | `getArgument(java.lang.String name)` Gets an | `java.util.Map<java.lang.String, java.lang.Object>` | `getArgument(int index)` Gets an | `java.util.List<java.util.Map<java.lang.String, java.lang.Object>>` | `getArguments()` Gets the list of defined arguments.
    `java.lang.Object` | `getDelegate()`
    `java.lang.String` | `getDescription()` Returns: the CLI description.
    `java.lang.String` | `getName()` Returns: the CLI name.
    `java.util.Map<java.lang.String, java.lang.Object>` | `getOption(java.lang.String name)` Gets an | `java.util.List<java.util.Map<java.lang.String, java.lang.Object>>` | `getOptions()` Gets the list of options.
    `java.lang.String` | `getSummary()` Returns: the CLI summary.
    `boolean` | `isHidden()` Checks whether or not the current CLI instance is hidden.
    `CommandLine` | `parse(java.util.List<java.lang.String> arguments)` Parses the user command line interface and create a new CommandLine containing extracting values.
    `CommandLine` | `parse(java.util.List<java.lang.String> arguments, boolean validate)` Parses the user command line interface and create a new CommandLine containing extracting values.
    `CLI` | `removeArgument(int index)` Removes an argument identified by its index.
    `CLI` | `removeOption(java.lang.String name)` Removes an option identified by its name.
    `CLI` | `setArguments(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> args)` Sets the list of arguments.
    `CLI` | `setDescription(java.lang.String desc)`
    `CLI` | `setHidden(boolean hidden)` Sets whether or not the current instance of CLI must be hidden.
    `CLI` | `setName(java.lang.String name)` Sets the name of the CLI.
    `CLI` | `setOptions(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> options)` Sets the list of arguments.
    `CLI` | `setSummary(java.lang.String summary)` Sets the summary of the CLI.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### CLI(java.lang.Object delegate)

  - ### Method Detail

    - #### CLI addArgument(java.util.Map<java.lang.String, java.lang.Object> arg = [:])

      Adds an argument.

      Returns:
        the current CLI instance
      Parameters:
        `arg` - the argument, must not be `null` (see Argument)

    - #### CLI addArguments(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> args)

      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.

      Returns:
        the current CLI instance
      Parameters:
        `args` - the arguments, must not be `null`

    - #### CLI addOption(java.util.Map<java.lang.String, java.lang.Object> option = [:])

      Adds an option.

      Returns:
        the current CLI instance
      Parameters:
        `option` - the option, must not be `null`. (see Option)

    - #### CLI addOptions(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> options)

      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.

      Returns:
        the current CLI instance
      Parameters:
        `options` - the options, must not be `null`

    - #### static CLI create(java.lang.String name)

      Creates an instance of CLI using the default implementation.

      Returns:
        the created instance of CLI
      Parameters:
        `name` - the name of the CLI (must not be `null`)

    - #### java.util.Map<java.lang.String, java.lang.Object> getArgument(java.lang.String name)

      Gets an Argument based on its name (argument name).

      Returns:
        the Argument, `null` if not found. (see Argument)
      Parameters:
        `name` - the name of the argument, must not be `null`

    - #### java.util.Map<java.lang.String, java.lang.Object> getArgument(int index)

      Gets an Argument based on its index.

      Returns:
        the Argument, `null` if not found. (see Argument)
      Parameters:
        `index` - the index, must be positive or zero.

    - #### java.util.List<java.util.Map<java.lang.String, java.lang.Object>> getArguments()

      Gets the list of defined arguments.

      Returns:
        the list of argument, empty if none.

    - #### java.lang.Object getDelegate()

    - #### java.lang.String getDescription()

      Returns:
        the CLI description.

    - #### java.lang.String getName()

      Returns:
        the CLI name.

    - #### java.util.Map<java.lang.String, java.lang.Object> getOption(java.lang.String name)

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

      Returns:
        the Option, `null` if not found (see Option)
      Parameters:
        `name` - the name, must not be `null`

    - #### java.util.List<java.util.Map<java.lang.String, java.lang.Object>> getOptions()

      Gets the list of options.

      Returns:
        the list of options, empty if none.

    - #### java.lang.String getSummary()

      Returns:
        the CLI summary.

    - #### boolean isHidden()

      Checks whether or not the current CLI instance is hidden.

      Returns:
        `true` if the current CLI is hidden, otherwise

    - #### CommandLine parse(java.util.List<java.lang.String> arguments)

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

      Returns:
        the creates command line
      Parameters:
        `arguments` - the arguments

    - #### CommandLine parse(java.util.List<java.lang.String> arguments, boolean validate)

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

      Returns:
        the creates command line
      Parameters:
        `arguments` - the arguments
        `validate` - enable / disable parsing validation

    - #### CLI removeArgument(int index)

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

      Returns:
        the current CLI instance
      Parameters:
        `index` - the argument index

    - #### CLI removeOption(java.lang.String name)

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

      Returns:
        the current CLI instance
      Parameters:
        `name` - the option name

    - #### CLI setArguments(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> args)

      Sets the list of arguments.

      Returns:
        the current CLI instance
      Parameters:
        `args` - the list of arguments, must not be `null`

    - #### CLI setDescription(java.lang.String desc)

    - #### CLI setHidden(boolean hidden)

      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.

      Returns:
        the current CLI instance
      Parameters:
        `hidden` - enables or disables the hidden aspect of the CI

    - #### CLI setName(java.lang.String name)

      Sets the name of the CLI.

      Returns:
        the current CLI instance
      Parameters:
        `name` - the name

    - #### CLI setOptions(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> options)

      Sets the list of arguments.

      Returns:
        the current CLI instance
      Parameters:
        `options` - the list of options, must not be `null`

    - #### CLI setSummary(java.lang.String summary)

      Sets the summary of the CLI.

      Returns:
        the current CLI instance
      Parameters:
        `summary` - the summary