|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.groovy.grails.cli.parsing.CommandLineParser
public class CommandLineParser
Command line parser that parses arguments to the command line. Written as a replacement for Commons CLI because it doesn't support unknown arguments and requires all arguments to be declared up front. It also doesn't support command options with hyphens. This class gets around those problems.
| Constructor Summary | |
|---|---|
CommandLineParser()
|
|
| Method Summary | |
|---|---|
void |
addOption(java.lang.String name,
java.lang.String description)
Adds a declared option |
protected DefaultCommandLine |
createCommandLine()
|
static CommandLine |
getCurrentCommandLine()
|
java.lang.String |
getOptionsHelpMessage()
|
CommandLine |
parse(java.lang.String... args)
Parses the given list of command line arguments. |
CommandLine |
parseString(java.lang.String string)
Parses a string of all the command line options converting them into an array of arguments to pass to #parse(String..args) |
CommandLine |
parseString(java.lang.String commandName,
java.lang.String args)
Parses a string of all the command line options converting them into an array of arguments to pass to #parse(String..args) |
protected void |
processOption(DefaultCommandLine cl,
java.lang.String arg)
|
protected void |
processSystemArg(DefaultCommandLine cl,
java.lang.String arg)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CommandLineParser()
| Method Detail |
|---|
public static CommandLine getCurrentCommandLine()
public void addOption(java.lang.String name,
java.lang.String description)
name - The name of the optiondescription - The descriptionpublic CommandLine parseString(java.lang.String string)
string - The string
public CommandLine parseString(java.lang.String commandName,
java.lang.String args)
commandName - The command nameargs - The string
public CommandLine parse(java.lang.String... args)
args - The arguments
public java.lang.String getOptionsHelpMessage()
protected DefaultCommandLine createCommandLine()
protected void processOption(DefaultCommandLine cl,
java.lang.String arg)
protected void processSystemArg(DefaultCommandLine cl,
java.lang.String arg)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||