Package org.apache.commons.cli
Interface CommandLineParser
- All Known Implementing Classes:
BasicParser,DefaultParser,GnuParser,Parser,PosixParser
public interface CommandLineParser
A class that implements the
CommandLineParser interface can parse a String array according to the
Options specified and return a CommandLine.-
Method Summary
Modifier and TypeMethodDescriptionParses the arguments according to the specified options.Parses the arguments according to the specified options.
-
Method Details
-
parse
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, String[] arguments, boolean stopAtNonOption) throws ParseException Parses the arguments according to the specified options.- Parameters:
options- the specified Optionsarguments- the command line argumentsstopAtNonOption- iftruean unrecognized argument stops the parsing and the remaining arguments are added to theCommandLines args list. Iffalsean 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.
-