Interface CommandLine

All Known Implementing Classes:
CommandLineImpl

public interface CommandLine
Author:
flasbyst
  • Method Summary

    Modifier and Type
    Method
    Description
    returns the value of the default, if any.
    returns an array of values containing all the values provided as defaults.
    returns all the options parsed by this commandline instance.
    boolean
    getValue(Flag flag)
    returns the value of the flag.
    getValue(Option option)
    returns the value of the option, if any.
    returns an array of values containing all the values provided for this option.
    boolean
    informs if a default Option was provided on the commandline.
    boolean
    informs if the specified Option was provided on the commandline.
  • Method Details

    • wasProvided

      boolean wasProvided(Option option)
      informs if the specified Option was provided on the commandline. Note that missing or unknown arguments will be flagged by a suitable exception.
      Parameters:
      option -
      Returns:
    • wasDefaultProvided

      boolean wasDefaultProvided()
      informs if a default Option was provided on the commandline. By default I mean a value with no option flag, or one preceeded by '- '.
      Returns:
    • getValue

      String getValue(Option option)
      returns the value of the option, if any. If the option was provided more than once and a value was provided more than once then this will return the first one provided.
      Parameters:
      option - - the option value required.
      Returns:
      null if the option was not provided or no value for the option was provided, otherwise the actual value of the option.
    • getDefaultValue

      String getDefaultValue()
      returns the value of the default, if any. If the default value was provided more than once and then this will return the first one provided.
      Returns:
      null if no default value was provided otherwise the actual value of the option.
    • getValues

      String[] getValues(OptionList option)
      returns an array of values containing all the values provided for this option. If the option was specified 3 times, then this array could be up to length 3. Note that if only 2 out of the three options actually provided a value, then this array will only have a length of 2. It will never return null. The values will be returned in the order encountered on the command line.
      Parameters:
      option -
      Returns:
      an array of all the values provided on the command line for this option.
    • getDefaultValues

      String[] getDefaultValues()
      returns an array of values containing all the values provided as defaults. That is, all values provided without a prceeding option or preceeded by a '- '. It will never return null. The values will be returned in the order encountered on the command line.
      Returns:
      an array of all the values provided on the command line for this option.
    • getValue

      boolean getValue(Flag flag)
      returns the value of the flag. That is, was the flag provided on the commandline.
      Parameters:
      flag -
      Returns:
    • getOptions

      Options getOptions()
      returns all the options parsed by this commandline instance.
      Returns: