public class DefaultNutsCommandLine extends Object implements 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<NutsArgument> |
lookahead |
protected NutsSession |
session |
protected Set<String> |
specialSimpleOptions |
| Constructor and Description |
|---|
DefaultNutsCommandLine(List<String> args) |
DefaultNutsCommandLine(NutsApplicationContext context) |
DefaultNutsCommandLine(NutsSession session) |
DefaultNutsCommandLine(NutsSession session,
List<String> args,
NutsCommandAutoComplete autoComplete) |
DefaultNutsCommandLine(NutsSession session,
String[] args) |
DefaultNutsCommandLine(NutsSession session,
String[] args,
NutsCommandAutoComplete autoComplete) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitof, parseforEach, spliteratorformatprotected LinkedList<String> args
protected List<NutsArgument> lookahead
protected boolean expandSimpleOptions
protected String commandName
protected NutsSession session
public DefaultNutsCommandLine(NutsSession session)
public DefaultNutsCommandLine(NutsApplicationContext context)
public DefaultNutsCommandLine(NutsSession session, String[] args, NutsCommandAutoComplete autoComplete)
public DefaultNutsCommandLine(NutsSession session, String[] args)
public DefaultNutsCommandLine(NutsSession session, List<String> args, NutsCommandAutoComplete autoComplete)
public NutsWorkspace getWorkspace()
public NutsCommandLine setAutoComplete(NutsCommandAutoComplete autoComplete)
setAutoComplete in interface NutsCommandLinepublic NutsCommandAutoComplete getAutoComplete()
getAutoComplete in interface NutsCommandLinepublic NutsCommandLine unregisterSpecialSimpleOption(String option)
unregisterSpecialSimpleOption in interface NutsCommandLinepublic String[] getSpecialSimpleOptions()
getSpecialSimpleOptions in interface NutsCommandLinepublic NutsCommandLine registerSpecialSimpleOption(String option)
registerSpecialSimpleOption in interface NutsCommandLinepublic boolean isSpecialSimpleOption(String option)
isSpecialSimpleOption in interface NutsCommandLinepublic int getWordIndex()
getWordIndex in interface NutsCommandLinepublic boolean isExecMode()
isExecMode in interface NutsCommandLinepublic boolean isAutoCompleteMode()
isAutoCompleteMode in interface NutsCommandLinepublic String getCommandName()
getCommandName in interface NutsCommandLinepublic NutsCommandLine setCommandName(String commandName)
setCommandName in interface NutsCommandLinepublic boolean isExpandSimpleOptions()
isExpandSimpleOptions in interface NutsCommandLinepublic NutsCommandLine setExpandSimpleOptions(boolean expand)
setExpandSimpleOptions in interface NutsCommandLinepublic NutsCommandLine requireNonOption()
requireNonOption in interface NutsCommandLinepublic NutsCommandLine unexpectedArgument(NutsString errorMessage)
unexpectedArgument in interface NutsCommandLinepublic NutsCommandLine unexpectedArgument(NutsMessage errorMessage)
unexpectedArgument in interface NutsCommandLinepublic NutsCommandLine unexpectedArgument()
unexpectedArgument in interface NutsCommandLinepublic NutsCommandLine required()
required in interface NutsCommandLinepublic NutsCommandLine required(NutsString errorMessage)
required in interface NutsCommandLinepublic NutsCommandLine required(NutsMessage errorMessage)
required in interface NutsCommandLinepublic NutsCommandLine pushBack(NutsArgument arg)
pushBack in interface NutsCommandLinepublic NutsArgument next()
next in interface NutsCommandLinepublic NutsArgument next(NutsArgumentName name)
next in interface NutsCommandLinepublic NutsArgument peek()
peek in interface NutsCommandLinepublic boolean hasNext()
hasNext in interface NutsCommandLinepublic NutsArgument nextBoolean(String... names)
nextBoolean in interface NutsCommandLinepublic NutsArgument nextString(String... names)
nextString in interface NutsCommandLinepublic NutsArgument next(String... names)
next in interface NutsCommandLinepublic NutsArgument next(NutsArgumentType expectValue, String... names)
next in interface NutsCommandLinepublic NutsArgument nextRequiredNonOption(NutsArgumentName name)
nextRequiredNonOption in interface NutsCommandLinepublic NutsArgument nextNonOption()
nextNonOption in interface NutsCommandLinepublic NutsArgument nextNonOption(NutsArgumentName name)
nextNonOption in interface NutsCommandLinepublic int skipAll()
skipAll in interface NutsCommandLinepublic int skip()
skip in interface NutsCommandLinepublic int skip(int count)
skip in interface NutsCommandLinepublic boolean accept(String... values)
accept in interface NutsCommandLinepublic boolean accept(int index,
String... values)
accept in interface NutsCommandLinepublic NutsArgument find(String name)
find in interface NutsCommandLinepublic NutsArgument get(int index)
get in interface NutsCommandLinepublic boolean contains(String name)
contains in interface NutsCommandLinepublic int indexOf(String name)
indexOf in interface NutsCommandLinepublic int length()
length in interface NutsCommandLinepublic boolean isEmpty()
isEmpty in interface NutsCommandLinepublic String[] toStringArray()
toStringArray in interface NutsCommandLinepublic NutsArgument[] toArgumentArray()
toArgumentArray in interface NutsCommandLinepublic boolean isOption(int index)
isOption in interface NutsCommandLinepublic boolean isNonOption(int index)
isNonOption in interface NutsCommandLinepublic NutsCommandLine parseLine(String commandLine)
parseLine in interface NutsCommandLinepublic NutsCommandLine setArguments(List<String> arguments)
setArguments in interface NutsCommandLinepublic NutsCommandLine setArguments(String[] arguments)
setArguments in interface NutsCommandLinepublic void throwError(NutsMessage message)
throwError in interface NutsCommandLinepublic void process(NutsCommandLineConfigurable defaultConfigurable, NutsCommandLineProcessor commandLineProcessor)
process in interface NutsCommandLinepublic void throwError(NutsString message)
throwError in interface NutsCommandLinepublic NutsCommandLineFormat formatter()
formatter in interface NutsCommandLineformatter in interface NutsFormattablepublic NutsArgument next(NutsArgumentName name, boolean forceNonOption, boolean error)
public NutsArgument next(boolean required, boolean expandSimpleOptions)
public NutsCommandLine copy()
public Iterator<NutsArgument> iterator()
iterator in interface Iterable<NutsArgument>Copyright © 2021 vpc open source initiative. All rights reserved.