java.lang.Object
org.htmlparser.util.CommandLine
- public class CommandLine
- extends java.lang.Object
Simple command like parser/handler. A dashed argument is one preceded by a
dash character. In a sequence of arguments: 1) If a dashed argument starts
with a command character the rest of the argument, if any, is assume to be a
value. 2) If a dashed argument is followed by a non-dashed argument value.
The value is assumed to be associated with the preceding dashed argument
name. 2) If an argument with a dash prefix is not followed by a non-dashed
value, and does not use a command character, it is assumed to be a flag. 3)
If none of the above is true, the argument is a name.
Command characters can be added with the addCommand method. Values can be
retrieved with the getValue method. Flag states can be retrieved with the
getFlag method. Names can be retieved with the getNameCount and getName
methods.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VERBOSE
public static boolean VERBOSE
commands
protected java.util.List commands
flags
protected java.util.List flags
names
protected java.util.List names
values
protected java.util.Map values
CommandLine
public CommandLine(java.lang.String chars,
java.lang.String[] args)
CommandLine
public CommandLine(java.lang.String[] args)
parse
protected void parse(java.lang.String[] args)
addCommand
public void addCommand(char command)
hasValue
public boolean hasValue(java.lang.String key)
getValue
public java.lang.String getValue(java.lang.String key)
getFlag
public boolean getFlag(java.lang.String key)
getNameCount
public int getNameCount()
getName
public java.lang.String getName(int index)
main
public static void main(java.lang.String[] args)