net.sf.mmm.util.cli.api
Interface CliParser

All Known Implementing Classes:
AbstractCliParser, DefaultCliParser

public interface CliParser

This is the interface used to parse the command-line arguments of a main-program.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
See Also:
CliClass

Field Summary
static char CHAR_OPTION
          The option prefix character.
static String END_OPTIONS
          The argument used to indicate that options are complete and arguments will follow.
static String PREFIX_LONG_OPTION
          The prefix for name or alias of a long option.
static String PREFIX_SHORT_OPTION
          The prefix for name or alias of a short option.
 
Method Summary
 CliModeObject parseParameters(String... parameters)
          This method parses the given command-line parameters and applies the parsed options and arguments to the Pojo that was supplied when building this parser.
 void printHelp(Appendable target)
          This method prints the help (program usage) generated from the annotations to the given Appendable using default settings.
 void printHelp(Appendable target, CliOutputSettings settings)
          This method prints the help (program usage) generated from the annotations to the given Appendable using the given settings.
 

Field Detail

CHAR_OPTION

static final char CHAR_OPTION
The option prefix character.

See Also:
PREFIX_SHORT_OPTION, PREFIX_LONG_OPTION, Constant Field Values

PREFIX_SHORT_OPTION

static final String PREFIX_SHORT_OPTION
The prefix for name or alias of a short option. Value is "-" (e.g. "-h").

See Also:
Constant Field Values

PREFIX_LONG_OPTION

static final String PREFIX_LONG_OPTION
The prefix for name or alias of a long option. Value is "--" (e.g. "--help").

See Also:
Constant Field Values

END_OPTIONS

static final String END_OPTIONS
The argument used to indicate that options are complete and arguments will follow. This allows to specify an argument that is equal to an option (e.g. "cat -- --help" would print the contents of a file named "--help" rather that printing the help usage output).

See Also:
Constant Field Values
Method Detail

printHelp

void printHelp(Appendable target)
This method prints the help (program usage) generated from the annotations to the given Appendable using default settings.

Parameters:
target - is the Appendable where to print to.
See Also:
printHelp(Appendable, CliOutputSettings)

printHelp

void printHelp(Appendable target,
               CliOutputSettings settings)
This method prints the help (program usage) generated from the annotations to the given Appendable using the given settings.

Parameters:
target - is the Appendable where to print to.
settings - are the CliOutputSettings used to configure the output.

parseParameters

CliModeObject parseParameters(String... parameters)
                              throws CliException
This method parses the given command-line parameters and applies the parsed options and arguments to the Pojo that was supplied when building this parser.

Parameters:
parameters - are the command-line arguments of the main-program.
Returns:
the mode that was triggered.
Throws:
CliException - if the given arguments are invalid.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.