Package org.apache.commons.cli
Interface CommandLineParser
-
- All Known Implementing Classes:
BasicParser
,DefaultParser
,GnuParser
,Parser
,PosixParser
public interface CommandLineParser
A class that implements theCommandLineParser
interface can parse a String array according to theOptions
specified and return aCommandLine
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CommandLine
parse(Options options, java.lang.String[] arguments)
Parses the arguments according to the specified options.CommandLine
parse(Options options, java.lang.String[] arguments, boolean stopAtNonOption)
Parses the arguments according to the specified options.
-
-
-
Method Detail
-
parse
CommandLine parse(Options options, java.lang.String[] arguments) throws ParseException
Parses the arguments according to the specified options.- Parameters:
options
- the specified Optionsarguments
- the command line arguments- Returns:
- the list of atomic option and value tokens
- Throws:
ParseException
- if there are any problems encountered while parsing the command line tokens.
-
parse
CommandLine parse(Options options, java.lang.String[] arguments, boolean stopAtNonOption) throws ParseException
Parses the arguments according to the specified options.- Parameters:
options
- the specified Optionsarguments
- the command line argumentsstopAtNonOption
- iftrue
an unrecognized argument stops the parsing and the remaining arguments are added to theCommandLine
s args list. Iffalse
an unrecognized argument triggers a ParseException.- Returns:
- the list of atomic option and value tokens
- Throws:
ParseException
- if there are any problems encountered while parsing the command line tokens.
-
-