io.vertx.core.cli

## Interface CommandLine

-     public interface CommandLine

  The parser transforms a CLI (a model) into an `CommandLine`. This `CommandLine` has stored the argument and option values. Only instance of parser should create objects of this type.
  Author:
    Clement Escoffier

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `acceptMoreValues(Option option)` Checks whether or not the given option accept more values.
    `List<String>` | `allArguments()`
    `CLI` | `cli()`
    `static CommandLine` | `create(CLI cli)` Creates a command line object from the `CLI`.
    `<T> T` | `getArgumentValue(int index)` Gets the value of an argument with the given index.
    `<T> T` | `getArgumentValue(String name)` Gets the value of an argument with the matching name (arg name).
    `<T> T` | `getOptionValue(String name)` Gets the value of an option with the matching name (can be the long name, short name or arg name).
    `<T> List<T>` | `getOptionValues(String name)` Gets the values of an option with the matching name (can be the long name, short name or arg name).
    `String` | `getRawValueForArgument(Argument arg)` Gets the raw value of the given argument.
    `String` | `getRawValueForOption(Option option)` Gets the raw value of the given option.
    `List<String>` | `getRawValues(Option option)` Gets the raw values of the given option.
    `boolean` | `isArgumentAssigned(Argument arg)` Checks whether or not the given argument has been assigned in the command line.
    `boolean` | `isFlagEnabled(String name)` Gets the value of an option marked as a flag.
    `boolean` | `isOptionAssigned(Option option)` Checks whether or not the given option has been assigned in the command line.
    `boolean` | `isSeenInCommandLine(Option option)` check whether or not the given option has been seen in the user command line.

- - ### Method Detail

    - #### create

          static CommandLine create(CLI cli)

      Creates a command line object from the `CLI`. This object is intended to be used by the parser to set the argument and option values.
      Parameters:
        `cli` - the CLI definition
      Returns:
        the command line object

    - #### cli

          CLI cli()

      Returns:
        the model of this command line object.

    - #### allArguments

          List<String> allArguments()

      Returns:
        the ordered list of arguments. Arguments are command line arguments not matching an option.

    - #### getOptionValue

          <T> T getOptionValue(String name)

      Gets the value of an option with the matching name (can be the long name, short name or arg name).
      Type Parameters:
        `T` - the expected type
      Parameters:
        `name` - the name
      Returns:
        the value, `null` if not set

    - #### getArgumentValue

          <T> T getArgumentValue(String name)

      Gets the value of an argument with the matching name (arg name).
      Type Parameters:
        `T` - the expected type
      Parameters:
        `name` - the name
      Returns:
        the value, `null` if not set

    - #### getArgumentValue

          <T> T getArgumentValue(int index)

      Gets the value of an argument with the given index.
      Type Parameters:
        `T` - the expected type
      Parameters:
        `index` - the index
      Returns:
        the value, `null` if not set

    - #### getOptionValues

          <T> List<T> getOptionValues(String name)

      Gets the values of an option with the matching name (can be the long name, short name or arg name).
      Type Parameters:
        `T` - the expected component type
      Parameters:
        `name` - the name
      Returns:
        the values, `null` if not set
      See Also:
        `getRawValues(Option)`

    - #### isFlagEnabled

          boolean isFlagEnabled(String name)

      Gets the value of an option marked as a flag.

      Calling this method an a non-flag option throws an `IllegalStateException`.
      Parameters:
        `name` - the option name
      Returns:
        `true` if the flag has been set in the command line, `false` otherwise.

    - #### isOptionAssigned

          boolean isOptionAssigned(Option option)

      Checks whether or not the given option has been assigned in the command line.
      Parameters:
        `option` - the option
      Returns:
        `true` if the option has received a value, `false` otherwise.

    - #### getRawValues

          List<String> getRawValues(Option option)

      Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.
      Parameters:
        `option` - the option
      Returns:
        the list of values, empty if none

    - #### getRawValueForOption

          String getRawValueForOption(Option option)

      Gets the raw value of the given option. Raw values are the values as given in the user command line.
      Parameters:
        `option` - the option
      Returns:
        the value, `null` if none.

    - #### acceptMoreValues

          boolean acceptMoreValues(Option option)

      Checks whether or not the given option accept more values.
      Parameters:
        `option` - the option
      Returns:
        `true` if the option accepts more values, `false` otherwise.

    - #### getRawValueForArgument

          String getRawValueForArgument(Argument arg)

      Gets the raw value of the given argument. Raw values are the values as given in the user command line.
      Parameters:
        `arg` - the argument
      Returns:
        the value, `null` if none.

    - #### isArgumentAssigned

          boolean isArgumentAssigned(Argument arg)

      Checks whether or not the given argument has been assigned in the command line.
      Parameters:
        `arg` - the argument
      Returns:
        `true` if the argument has received a value, `false` otherwise.

    - #### isSeenInCommandLine

          boolean isSeenInCommandLine(Option option)

      check whether or not the given option has been seen in the user command line.
      Parameters:
        `option` - the option
      Returns:
        `true` if the user command line has used the option

Copyright © 2015. All rights reserved.