use of jline.console.completer.FileNameCompleter in project scheduling by ow2-proactive.
the class JLineDevice method setCommands.
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);
}
use of jline.console.completer.FileNameCompleter in project JaPS by JackWhite20.
the class JaPS method init.
public void init() {
System.setProperty("library.jansi.version", "JaPS");
AnsiConsole.systemInstall();
try {
consoleReader = new ConsoleReader();
consoleReader.setExpandEvents(false);
} catch (IOException e) {
e.printStackTrace();
}
// Setup logging system
logger = new JaPSLogger(consoleReader);
System.setErr(new PrintStream(new LoggingOutputStream(logger, Level.SEVERE), true));
System.setOut(new PrintStream(new LoggingOutputStream(logger, Level.INFO), true));
// Register command
commandManager = new CommandManager();
commandManager.addCommand(new HelpCommand("help", new String[] { "h" }, "Show this output"));
commandManager.addCommand(new SubCommand("sub", new String[] { "s", "subscribe" }, "Subscribe a channel and view it's prepareCacheSync passing"));
commandManager.addCommand(new UnsubCommand("unsub", new String[] {}, "Unsubscribe previous subscribed channels"));
commandManager.addCommand(new EndCommand("end", new String[] { "stop" }, "Shutdown the server"));
commandManager.addCommand(new SetCommand("set", new String[] { "add" }, "Sets a key and value"));
commandManager.addCommand(new GetCommand("get", new String[] {}, "Gets a value from a key"));
commandManager.addCommand(new DeleteCommand("delete", new String[] { "remove", "del", "rm" }, "Gets a value from a key"));
commandManager.addCommand(new SnapshotCommand("snapshot", new String[] {}, "Takes a memory snapshot"));
// Autocomplete commands
consoleReader.addCompleter(new StringsCompleter(commandManager.getCommands().stream().map(Command::getName).collect(Collectors.toList())));
// Autocomplete files
consoleReader.addCompleter(new FileNameCompleter());
logger.info("Initialized");
}
Aggregations