Class CommandLine
java.lang.Object
net.thevpc.common.commandline.CommandLine
CommandLine args=new CommandLine(Arrays.asList("--!deleteLog","--deploy","/deploy/path","--deploy=/other-deploy/path","some-param"));
Argument a;
while (args.hasNext()) {
if ((a = args.readBooleanOption("--deleteLog")) != null) {
deleteLog = a.getBooleanValue();
} else if ((a = args.readStringOption("--deploy")) != null) {
apps.add(a.getStringValue());
} else if ((a = args.readNonOption()) != null) {
name = a.getString();
} else {
args.unexpectedArgument();
}
}
Created by vpc on 12/7/16.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassstatic enum -
Constructor Summary
ConstructorsConstructorDescriptionCommandLine(String[] args) CommandLine(String[] args, CommandAutoComplete autoComplete) CommandLine(List<String> args) CommandLine(List<String> args, CommandAutoComplete autoComplete) CommandLine(CommandLineContext context) -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptSequence(int pos, String... vals) booleancontainOption(String name) copy()findOption(String option) get()get(int i) intbooleanhasNext()intindexOfOption(String name) booleanbooleanisEmpty()booleanbooleanbooleanisNonOption(int index) booleanisOption()booleanisOption(int index) booleanbooleanintlength()read()booleanbooleanbooleanreadAllOnce(String... vals) readBooleanOption(String... names) reader()readImmediateStringOption(String... names) readNonOption(boolean expectValue, String name) readNonOption(String... names) readNonOption(NonOption name) readNonOption(NonOption name, boolean error) readOption(String... names) readOption(CommandLine.OptionType expectValue, String... names) readRequiredNonOption(String name) readRequiredOption(String name) readStringOption(String... names) readVoidOption(String... names) voidvoidvoidreset()voidvoidvoidsetAutoComplete(CommandAutoComplete autoComplete) intskip()intskip(int count) voidskipAll()String[]toArray()toString()voidvoidunexpectedArgument(String commandName)
-
Constructor Details
-
CommandLine
-
CommandLine
-
CommandLine
-
CommandLine
-
CommandLine
-
-
Method Details
-
copy
-
setArgs
-
setArgs
-
setAutoComplete
-
isExecMode
public boolean isExecMode() -
isAutoCompleteMode
public boolean isAutoCompleteMode() -
skip
public int skip() -
skip
public int skip(int count) -
isOption
public boolean isOption(int index) -
isNonOption
public boolean isNonOption(int index) -
isOption
public boolean isOption() -
isNonOption
public boolean isNonOption() -
isOption
-
isOption
-
readBooleanOption
-
readStringOption
-
readImmediateStringOption
-
readOption
-
readVoidOption
-
readOption
-
requiredNonOption
-
skipAll
public void skipAll() -
readNonOption
-
readRequiredOption
-
readRequiredNonOption
-
readRequiredNonOption
-
readNonOption
-
readNonOption
-
readRequiredNonOption
-
readNonOption
-
readNonOption
-
read
-
readAll
-
readAll
-
readAllOnce
-
acceptSequence
-
findOption
-
get
-
get
-
containOption
-
indexOfOption
-
length
public int length() -
requireEmpty
public void requireEmpty() -
unexpectedArgument
public void unexpectedArgument() -
unexpectedArgument
-
requireNonEmpty
public void requireNonEmpty() -
hasNext
public boolean hasNext() -
isEmpty
public boolean isEmpty() -
toArray
-
toString
-
getWordIndex
public int getWordIndex() -
getAutoComplete
-
reset
public void reset() -
reader
-