| java.lang.Object edu.umd.cs.findbugs.config.CommandLine
All known Subclasses: edu.umd.cs.findbugs.FindBugsCommandLine,
CommandLine | abstract public class CommandLine (Code) | | Helper class for parsing command line arguments.
|
Inner Class :public static class HelpRequestedException extends Exception | |
Method Summary | |
public void | addOption(String option, String argumentDesc, String description) Add an option requiring an argument. | public void | addSwitch(String option, String description) Add a command line switch. | public void | addSwitchWithOptionalExtraPart(String option, String optionExtraPartSynopsis, String description) Add a command line switch that allows optional extra
information to be specified as part of it. | public static String[] | expandOptionFiles(String[] argv, boolean ignoreComments, boolean ignoreBlankLines) Expand option files in given command line. | abstract protected void | handleOption(String option, String optionExtraPart) Callback method for handling an option. | abstract protected void | handleOptionWithArgument(String option, String argument) Callback method for handling an option with an argument. | public void | makeOptionUnlisted(String option) | public int | parse(String argv, int minArgs, int maxArgs, String usage) | public int | parse(String argv) Parse a command line. | public void | printUsage(OutputStream os) Print command line usage information to given stream. |
CommandLine | public CommandLine()(Code) | | |
addOption | public void addOption(String option, String argumentDesc, String description)(Code) | | Add an option requiring an argument.
Parameters: option - the option, must start with "-" Parameters: argumentDesc - brief (one or two word) description of the argument Parameters: description - single line description of the option |
addSwitch | public void addSwitch(String option, String description)(Code) | | Add a command line switch.
This method is for adding options that do not require
an argument.
Parameters: option - the option, must start with "-" Parameters: description - single line description of the option |
addSwitchWithOptionalExtraPart | public void addSwitchWithOptionalExtraPart(String option, String optionExtraPartSynopsis, String description)(Code) | | Add a command line switch that allows optional extra
information to be specified as part of it.
Parameters: option - the option, must start with "-" Parameters: optionExtraPartSynopsis - synopsis of the optional extra information Parameters: description - single-line description of the option |
expandOptionFiles | public static String[] expandOptionFiles(String[] argv, boolean ignoreComments, boolean ignoreBlankLines) throws IOException(Code) | | Expand option files in given command line.
Any token beginning with "@" is assumed to be an option file.
Option files contain one command line option per line.
Parameters: argv - the original command line Parameters: ignoreComments - ignore comments (lines starting with "#") Parameters: ignoreBlankLines - ignore blank lines the expanded command line |
handleOption | abstract protected void handleOption(String option, String optionExtraPart) throws IOException(Code) | | Callback method for handling an option.
Parameters: option - the option Parameters: optionExtraPart - the "extra" part of the option (everything after thecolon: e.g., "withMessages" in "-xml:withMessages");the empty string if there was no extra part |
handleOptionWithArgument | abstract protected void handleOptionWithArgument(String option, String argument) throws IOException(Code) | | Callback method for handling an option with an argument.
Parameters: option - the option Parameters: argument - the argument |
makeOptionUnlisted | public void makeOptionUnlisted(String option)(Code) | | Don't list this option when printing Usage information
Parameters: option - |
parse | public int parse(String argv) throws IOException, HelpRequestedException(Code) | | Parse a command line.
Calls down to handleOption() and handleOptionWithArgument() methods.
Stops parsing when it reaches the end of the command line,
or when a command line argument not starting with "-" is seen.
Parameters: argv - the arguments the number of arguments parsed; if equal toargv.length, then the entire command line was parsed throws: HelpRequestedException - |
printUsage | public void printUsage(OutputStream os)(Code) | | Print command line usage information to given stream.
Parameters: os - the output stream |
|
|