public class DefaultNutsCommandLine extends Object implements net.thevpc.nuts.NutsCommandLine
CommandLine args=new CommandLine(Arrays.asList("--!deleteLog","--deploy","/deploy/path","--deploy=/other-deploy/path","some-param"));
Argument a;
while (args.hasNext()) {
if ((a = args.nextBoolean("--deleteLog")) != null) {
deleteLog = a.getBooleanValue();
} else if ((a = args.nextString("--deploy")) != null) {
apps.add(a.getStringValue());
} else if ((a = args.next()) != null) {
name = a.getString();
} else {
args.unexpectedArgument();
}
}
Created by vpc on 12/7/16.| Modifier and Type | Field and Description |
|---|---|
protected LinkedList<String> |
args |
protected String |
commandName |
protected boolean |
expandSimpleOptions |
protected List<net.thevpc.nuts.NutsArgument> |
lookahead |
protected net.thevpc.nuts.NutsSession |
session |
protected Set<String> |
specialSimpleOptions |
| Constructor and Description |
|---|
DefaultNutsCommandLine(List<String> args) |
DefaultNutsCommandLine(net.thevpc.nuts.NutsApplicationContext context) |
DefaultNutsCommandLine(net.thevpc.nuts.NutsSession session) |
DefaultNutsCommandLine(net.thevpc.nuts.NutsSession session,
List<String> args,
net.thevpc.nuts.NutsCommandAutoComplete autoComplete) |
DefaultNutsCommandLine(net.thevpc.nuts.NutsSession session,
String[] args) |
DefaultNutsCommandLine(net.thevpc.nuts.NutsSession session,
String[] args,
net.thevpc.nuts.NutsCommandAutoComplete autoComplete) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(int index,
String... values) |
boolean |
accept(String... values) |
boolean |
contains(String name) |
net.thevpc.nuts.NutsCommandLine |
copy() |
net.thevpc.nuts.NutsArgument |
find(String name) |
net.thevpc.nuts.NutsCommandLineFormat |
formatter() |
net.thevpc.nuts.NutsArgument |
get(int index) |
net.thevpc.nuts.NutsCommandAutoComplete |
getAutoComplete() |
String |
getCommandName() |
net.thevpc.nuts.NutsSession |
getSession() |
String[] |
getSpecialSimpleOptions() |
int |
getWordIndex() |
boolean |
hasNext() |
int |
indexOf(String name) |
boolean |
isAutoCompleteMode() |
boolean |
isEmpty() |
boolean |
isExecMode() |
boolean |
isExpandSimpleOptions() |
boolean |
isNonOption(int index) |
boolean |
isOption(int index) |
boolean |
isSpecialSimpleOption(String option) |
Iterator<net.thevpc.nuts.NutsArgument> |
iterator() |
int |
length() |
net.thevpc.nuts.NutsArgument |
next() |
net.thevpc.nuts.NutsArgument |
next(boolean required,
boolean expandSimpleOptions) |
net.thevpc.nuts.NutsArgument |
next(net.thevpc.nuts.NutsArgumentName name) |
net.thevpc.nuts.NutsArgument |
next(net.thevpc.nuts.NutsArgumentName name,
boolean forceNonOption,
boolean error) |
net.thevpc.nuts.NutsArgument |
next(net.thevpc.nuts.NutsArgumentType expectValue,
String... names) |
net.thevpc.nuts.NutsArgument |
next(String... names) |
net.thevpc.nuts.NutsArgument |
nextBoolean(String... names) |
net.thevpc.nuts.NutsArgument |
nextNonOption() |
net.thevpc.nuts.NutsArgument |
nextNonOption(net.thevpc.nuts.NutsArgumentName name) |
net.thevpc.nuts.NutsArgument |
nextRequiredNonOption(net.thevpc.nuts.NutsArgumentName name) |
net.thevpc.nuts.NutsArgument |
nextString(String... names) |
net.thevpc.nuts.NutsCommandLine |
parseLine(String commandLine) |
net.thevpc.nuts.NutsArgument |
peek() |
net.thevpc.nuts.NutsCommandLine |
pushBack(net.thevpc.nuts.NutsArgument arg) |
net.thevpc.nuts.NutsCommandLine |
registerSpecialSimpleOption(String option) |
net.thevpc.nuts.NutsCommandLine |
required() |
net.thevpc.nuts.NutsCommandLine |
required(net.thevpc.nuts.NutsMessage errorMessage) |
net.thevpc.nuts.NutsCommandLine |
required(net.thevpc.nuts.NutsString errorMessage) |
net.thevpc.nuts.NutsCommandLine |
requiredNonOptions(String... nonOptions) |
net.thevpc.nuts.NutsCommandLine |
requiredOptions(String... options) |
net.thevpc.nuts.NutsCommandLine |
requireNonOption() |
net.thevpc.nuts.NutsCommandLine |
setArguments(List<String> arguments) |
net.thevpc.nuts.NutsCommandLine |
setArguments(String[] arguments) |
net.thevpc.nuts.NutsCommandLine |
setAutoComplete(net.thevpc.nuts.NutsCommandAutoComplete autoComplete) |
net.thevpc.nuts.NutsCommandLine |
setCommandName(String commandName) |
net.thevpc.nuts.NutsCommandLine |
setExpandSimpleOptions(boolean expand) |
int |
skip() |
int |
skip(int count) |
int |
skipAll() |
void |
throwError(net.thevpc.nuts.NutsMessage message) |
void |
throwError(net.thevpc.nuts.NutsString message) |
net.thevpc.nuts.NutsArgument[] |
toArgumentArray() |
String |
toString() |
String[] |
toStringArray() |
net.thevpc.nuts.NutsCommandLine |
unexpectedArgument() |
net.thevpc.nuts.NutsCommandLine |
unexpectedArgument(net.thevpc.nuts.NutsMessage errorMessage) |
net.thevpc.nuts.NutsCommandLine |
unexpectedArgument(net.thevpc.nuts.NutsString errorMessage) |
net.thevpc.nuts.NutsCommandLine |
unregisterSpecialSimpleOption(String option) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorprotected LinkedList<String> args
protected List<net.thevpc.nuts.NutsArgument> lookahead
protected boolean expandSimpleOptions
protected String commandName
protected net.thevpc.nuts.NutsSession session
public DefaultNutsCommandLine(net.thevpc.nuts.NutsSession session)
public DefaultNutsCommandLine(net.thevpc.nuts.NutsApplicationContext context)
public DefaultNutsCommandLine(net.thevpc.nuts.NutsSession session,
String[] args,
net.thevpc.nuts.NutsCommandAutoComplete autoComplete)
public DefaultNutsCommandLine(net.thevpc.nuts.NutsSession session,
String[] args)
public DefaultNutsCommandLine(net.thevpc.nuts.NutsSession session,
List<String> args,
net.thevpc.nuts.NutsCommandAutoComplete autoComplete)
public net.thevpc.nuts.NutsSession getSession()
public net.thevpc.nuts.NutsCommandAutoComplete getAutoComplete()
getAutoComplete in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine setAutoComplete(net.thevpc.nuts.NutsCommandAutoComplete autoComplete)
setAutoComplete in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine unregisterSpecialSimpleOption(String option)
unregisterSpecialSimpleOption in interface net.thevpc.nuts.NutsCommandLinepublic String[] getSpecialSimpleOptions()
getSpecialSimpleOptions in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine registerSpecialSimpleOption(String option)
registerSpecialSimpleOption in interface net.thevpc.nuts.NutsCommandLinepublic boolean isSpecialSimpleOption(String option)
isSpecialSimpleOption in interface net.thevpc.nuts.NutsCommandLinepublic int getWordIndex()
getWordIndex in interface net.thevpc.nuts.NutsCommandLinepublic boolean isExecMode()
isExecMode in interface net.thevpc.nuts.NutsCommandLinepublic boolean isAutoCompleteMode()
isAutoCompleteMode in interface net.thevpc.nuts.NutsCommandLinepublic String getCommandName()
getCommandName in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine setCommandName(String commandName)
setCommandName in interface net.thevpc.nuts.NutsCommandLinepublic boolean isExpandSimpleOptions()
isExpandSimpleOptions in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine setExpandSimpleOptions(boolean expand)
setExpandSimpleOptions in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine requireNonOption()
requireNonOption in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine unexpectedArgument(net.thevpc.nuts.NutsString errorMessage)
unexpectedArgument in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine unexpectedArgument(net.thevpc.nuts.NutsMessage errorMessage)
unexpectedArgument in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine unexpectedArgument()
unexpectedArgument in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine required()
required in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine requiredOptions(String... options)
requiredOptions in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine requiredNonOptions(String... nonOptions)
requiredNonOptions in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine required(net.thevpc.nuts.NutsString errorMessage)
required in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine required(net.thevpc.nuts.NutsMessage errorMessage)
required in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine pushBack(net.thevpc.nuts.NutsArgument arg)
pushBack in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument next()
next in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument next(net.thevpc.nuts.NutsArgumentName name)
next in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument peek()
peek in interface net.thevpc.nuts.NutsCommandLinepublic boolean hasNext()
hasNext in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument nextBoolean(String... names)
nextBoolean in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument nextString(String... names)
nextString in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument next(String... names)
next in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument next(net.thevpc.nuts.NutsArgumentType expectValue,
String... names)
next in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument nextRequiredNonOption(net.thevpc.nuts.NutsArgumentName name)
nextRequiredNonOption in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument nextNonOption()
nextNonOption in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument nextNonOption(net.thevpc.nuts.NutsArgumentName name)
nextNonOption in interface net.thevpc.nuts.NutsCommandLinepublic int skipAll()
skipAll in interface net.thevpc.nuts.NutsCommandLinepublic int skip()
skip in interface net.thevpc.nuts.NutsCommandLinepublic int skip(int count)
skip in interface net.thevpc.nuts.NutsCommandLinepublic boolean accept(String... values)
accept in interface net.thevpc.nuts.NutsCommandLinepublic boolean accept(int index,
String... values)
accept in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument find(String name)
find in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument get(int index)
get in interface net.thevpc.nuts.NutsCommandLinepublic boolean contains(String name)
contains in interface net.thevpc.nuts.NutsCommandLinepublic int indexOf(String name)
indexOf in interface net.thevpc.nuts.NutsCommandLinepublic int length()
length in interface net.thevpc.nuts.NutsCommandLinepublic boolean isEmpty()
isEmpty in interface net.thevpc.nuts.NutsCommandLinepublic String[] toStringArray()
toStringArray in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsArgument[] toArgumentArray()
toArgumentArray in interface net.thevpc.nuts.NutsCommandLinepublic boolean isOption(int index)
isOption in interface net.thevpc.nuts.NutsCommandLinepublic boolean isNonOption(int index)
isNonOption in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine parseLine(String commandLine)
parseLine in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine setArguments(List<String> arguments)
setArguments in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLine setArguments(String[] arguments)
setArguments in interface net.thevpc.nuts.NutsCommandLinepublic void throwError(net.thevpc.nuts.NutsMessage message)
throwError in interface net.thevpc.nuts.NutsCommandLinepublic void throwError(net.thevpc.nuts.NutsString message)
throwError in interface net.thevpc.nuts.NutsCommandLinepublic net.thevpc.nuts.NutsCommandLineFormat formatter()
formatter in interface net.thevpc.nuts.NutsCommandLineformatter in interface net.thevpc.nuts.NutsFormattablepublic net.thevpc.nuts.NutsArgument next(net.thevpc.nuts.NutsArgumentName name,
boolean forceNonOption,
boolean error)
public net.thevpc.nuts.NutsArgument next(boolean required,
boolean expandSimpleOptions)
public net.thevpc.nuts.NutsCommandLine copy()
Copyright © 2022 vpc open source initiative. All rights reserved.