本文整理汇总了Java中jline.console.completer.ArgumentCompleter类的典型用法代码示例。如果您正苦于以下问题:Java ArgumentCompleter类的具体用法?Java ArgumentCompleter怎么用?Java ArgumentCompleter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ArgumentCompleter类属于jline.console.completer包,在下文中一共展示了ArgumentCompleter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConsole
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
public ConsoleReader getConsole() throws IOException {
if (console == null) {
// console = new ConsoleReader(System.in, System.out);
console = new ConsoleReader();
}
String osName = builtIn.getLocalOsName();
if (osName.toLowerCase().contains("win")) {
System.out.println("-----your Console is terrible.-----\n"
+ "if it reports some errors, just ignore it.");
console.setPrompt("[email protected]" + builtIn.getHostname() + "> ");
} else {
console.setPrompt("\u001B[33mjweevely\u001B[[email protected]"
+ builtIn.getHostname() + "\u001B[33m>\u001B[0m ");
}
List<Completer> completors = new ArrayList<Completer>();
completors.add(new StringsCompleter(BuiltIn.BUILTIN_FUNCTION));
completors.add(new FileNameCompleter());
completors.add(new NullCompleter());
console.addCompleter(new ArgumentCompleter(completors));
return console;
}
示例2: CommandCompleter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
public CommandCompleter(ConsoleReader consoleReader,
ArgumentDelimiter argumentDelimiter, Iterable<Command> commands) {
this.console = consoleReader;
List<String> names = new ArrayList<String>();
for (Command command : commands) {
this.commands.add(command);
names.add(command.getName());
List<String> options = new ArrayList<String>();
for (OptionHelp optionHelp : command.getOptionsHelp()) {
options.addAll(optionHelp.getOptions());
}
AggregateCompleter argumentCompleters = new AggregateCompleter(
new StringsCompleter(options), new FileNameCompleter());
ArgumentCompleter argumentCompleter = new ArgumentCompleter(argumentDelimiter,
argumentCompleters);
argumentCompleter.setStrict(false);
this.commandCompleters.put(command.getName(), argumentCompleter);
}
getStrings().addAll(names);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:CommandCompleter.java
示例3: CommandCompleter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
public CommandCompleter(ConsoleReader consoleReader,
ArgumentDelimiter argumentDelimiter, Iterable<Command> commands) {
this.console = consoleReader;
List<String> names = new ArrayList<String>();
for (Command command : commands) {
this.commands.add(command);
names.add(command.getName());
List<String> options = new ArrayList<String>();
for (OptionHelp optionHelp : command.getOptionsHelp()) {
options.addAll(optionHelp.getOptions());
}
AggregateCompleter arguementCompleters = new AggregateCompleter(
new StringsCompleter(options), new FileNameCompleter());
ArgumentCompleter argumentCompleter = new ArgumentCompleter(argumentDelimiter,
arguementCompleters);
argumentCompleter.setStrict(false);
this.commandCompleters.put(command.getName(), argumentCompleter);
}
getStrings().addAll(names);
}
示例4: askForWorkflow
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
private void askForWorkflow() {
log.info("Press ENTER for getting started info");
log.info("");
log.info("Press tab to see a list of available workflows, up to see previously entered workflows");
ArgumentCompleter argumentsCompleter = createWorkflowCompleter();
String workFlowText = InputUtils.readValue("Workflow(Type " + EXIT_WORKFLOW + " to exit)",
argumentsCompleter, workflowHistory).trim();
if (workFlowText.equals(EXIT_WORKFLOW)) {
log.info("Exiting");
System.exit(0);
}
String[] workflowTextPieces = splitWorkflowTextIntoArguments(workFlowText);
configParser.updateWithRuntimeArguments(config, workflowTextPieces);
}
示例5: SqlLineCommandCompleter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
public SqlLineCommandCompleter(SqlLine sqlLine) {
List<ArgumentCompleter> completers = new LinkedList<ArgumentCompleter>();
for (CommandHandler commandHandler : sqlLine.commandHandlers) {
for (String cmd : commandHandler.getNames()) {
List<Completer> compl = new LinkedList<Completer>();
compl.add(new StringsCompleter(SqlLine.COMMAND_PREFIX + cmd));
compl.addAll(commandHandler.getParameterCompleters());
compl.add(new NullCompleter()); // last param no complete
completers.add(new ArgumentCompleter(compl));
}
}
getCompleters().addAll(completers);
}
示例6: resetCompletors
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
protected void resetCompletors() {
removeAllcompleters();
addcompleters(new AggregateCompleter(
Collections2.transform(commandMappings.keySet(), new Function<Call, Completer>() {
@Override
public Completer apply(final Call input) {
return new ArgumentCompleter(
ImmutableList.<Completer>builder()
.add(new StringsCompleter(input.commandName()))
.add(input.completers())
.build()
);
}
})
));
}
示例7: Init
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
/** Client initialization */
public void Init( String url ) {
if( url != null && !url.equals( "" ) )
_server_url = url;
try {
_servidor = new XmlRpcClientBase( _server_url );
_reader = new ConsoleReader();
_reader.setBellEnabled( false );
List completors = new LinkedList();
completors.add( new StringsCompleter( _commandList ) );
_reader.addCompleter( new ArgumentCompleter( completors ) );
} catch (Exception exception) {
System.err.println("error: " + exception.toString());
}
}
示例8: setCommands
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
public void setCommands(CommandSet.Entry[] entries) throws IOException {
AggregateCompleter aggregateCompleter = new AggregateCompleter(new SimpleCompletor(getCommandsAsArray(entries)),
new ClassNameCompletor(),
new FileNameCompleter());
ArgumentCompleter argumentCompleter = new ArgumentCompleter(createArgumentDelimiter(), aggregateCompleter);
argumentCompleter.setStrict(false);
reader.addCompleter(argumentCompleter);
}
示例9: createArgumentDelimiter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
private ArgumentCompleter.WhitespaceArgumentDelimiter createArgumentDelimiter() {
return new ArgumentCompleter.WhitespaceArgumentDelimiter() {
@Override
public boolean isDelimiterChar(CharSequence buffer, int pos) {
return super.isDelimiterChar(buffer, pos) || buffer.charAt(pos) == '\'' || buffer.charAt(pos) == '"' ||
buffer.charAt(pos) == '{' || buffer.charAt(pos) == '}' || buffer.charAt(pos) == ',' ||
buffer.charAt(pos) == ';';
}
};
}
示例10: getArgumentCompleter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new SessionVarCompleter(),
NullCompleter.INSTANCE);
}
示例11: getArgumentCompleter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new TableNameCompleter(),
NullCompleter.INSTANCE);
}
示例12: getArgumentCompleter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
TajoConf.ConfVars[] vars = TajoConf.ConfVars.values();
List<String> confNames = new ArrayList<>();
for(TajoConf.ConfVars varname: vars) {
confNames.add(varname.varname);
}
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new ConfCompleter(confNames.toArray(new String[confNames.size()])),
NullCompleter.INSTANCE);
}
示例13: getArgumentCompleter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new DbNameCompleter(),
NullCompleter.INSTANCE);
}
示例14: getArgumentCompleter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
List<String> cmds = new ArrayList<>(Arrays.asList(getAliases()));
cmds.add(getCommand());
return new ArgumentCompleter(
new StringsCompleter(cmds.toArray(new String[cmds.size()])),
new StringsCompleter("copyright", "version", "?", "help", "q", "l", "c", "d", "df", "!", "dfs", "admin",
"set", "unset", "haadmin", "getconf"), // same order as help string
NullCompleter.INSTANCE);
}
示例15: getArgumentCompleter
import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new FunctionNameCompleter(),
NullCompleter.INSTANCE);
}