类 SimpleCommandLineArgsParser
String[] of command line arguments in order to populate a
CommandLineArgs object.
Working with option arguments
Option arguments must adhere to the exact syntax:
--optName[=optValue]
That is, options must be prefixed with "--" and may or may not
specify a value. If a value is specified, the name and value must be separated
without spaces by an equals sign ("="). The value may optionally be
an empty string.
Valid examples of option arguments
--foo --foo= --foo="" --foo=bar --foo="bar then baz" --foo=bar,baz,biz
Invalid examples of option arguments
-foo --foo bar --foo = bar --foo=bar --foo=baz --foo=biz
End of option arguments
This parser supports the POSIX "end of options" delimiter, meaning that any
"--" (empty option name) in the command line signals that all remaining
arguments are non-option arguments. For example, "--opt1=ignored",
"--opt2", and "filename" in the following command line are
considered non-option arguments.
--foo=bar -- --opt1=ignored -opt2 filename
Working with non-option arguments
Any arguments following the "end of options" delimiter (--) or
specified without the "--" option prefix will be considered as
"non-option arguments" and made available through the
CommandLineArgs.getNonOptionArgs() method.
- 从以下版本开始:
- 4.0
- 作者:
- Chris Beams, Sam Brannen, Harry Yang
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static CommandLineArgsParse the givenStringarray based on the rules described above, returning a fully-populatedCommandLineArgsobject.
-
构造器详细资料
-
SimpleCommandLineArgsParser
public SimpleCommandLineArgsParser()
-
-
方法详细资料
-
parse
Parse the givenStringarray based on the rules described above, returning a fully-populatedCommandLineArgsobject.- 参数:
args- command line arguments, typically from amain()method
-