org.apache.ode.utils.cli
Interface CommandlineFragment

All Known Implementing Classes:
Argument, Flag, FlagWithArgument, LastArgument, MultiArgument, XorGroup

public interface CommandlineFragment

Basic interface for a fragment of a commandline; that fragment could be a single flag, could be a flag with one or more arguments, or could be an argument.


Field Summary
static java.lang.String COMMAND_PREFIX
          The prefix ("-") that signifies that an argument is a flag.
 
Method Summary
 java.util.List<java.lang.String> consume(java.util.List<java.lang.String> s)
           Grab the pieces of the commandline relevant to this argument, configure the implementation, and then return a new array of arguments that will have the pieces of the original commandline that this command used removed.
 java.lang.String getDescription()
           Return a description of this commandline fragment.
 java.lang.String getUsage()
           Construct a usage string for this commandline fragment.
 boolean isOptional()
           
 void reset()
           Reset the fragment to its initial state.
 

Field Detail

COMMAND_PREFIX

static final java.lang.String COMMAND_PREFIX
The prefix ("-") that signifies that an argument is a flag.

See Also:
Constant Field Values
Method Detail

reset

void reset()

Reset the fragment to its initial state. This is useful for reusing fragments in multiple commandline structures.


consume

java.util.List<java.lang.String> consume(java.util.List<java.lang.String> s)
                                         throws CommandlineSyntaxException

Grab the pieces of the commandline relevant to this argument, configure the implementation, and then return a new array of arguments that will have the pieces of the original commandline that this command used removed.

Parameters:
s - the list of arguments
Returns:
the list of arguments, post parse
Throws:
CommandlineSyntaxException - if the commandline is structurally invalid.

getUsage

java.lang.String getUsage()

Construct a usage string for this commandline fragment. The usage string is used when constructing a strawman commandline example and when formatting help.

Returns:
the usage string

getDescription

java.lang.String getDescription()

Return a description of this commandline fragment. The description should be a (short) narrative item that describes the purpose of the fragment. It is only used when formatting help.

Returns:
the description

isOptional

boolean isOptional()
Returns:
true if this fragment is optional.