Search in sources :

Example 1 with CommandHelp

use of commandHelp.CommandHelp in project ASCIIGenome by dariober.

the class Main method initConsole.

public static ConsoleReader initConsole() throws IOException, InvalidColourException {
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {

        public void run() {
            // On exit turn off all formatting
            System.out.print("\033[0m");
        }
    }));
    ConsoleReader console = new ConsoleReader();
    try {
        // Autcomplete commands with length > x
        for (CommandHelp x : CommandList.commandHelpList()) {
            if (x.getName().length() > 2) {
                console.addCompleter(new StringsCompleter(x.getName()));
            }
        }
    } catch (InvalidCommandLineException e) {
        e.printStackTrace();
    }
    console.setExpandEvents(false);
    return console;
}
Also used : ConsoleReader(jline.console.ConsoleReader) StringsCompleter(jline.console.completer.StringsCompleter) CommandHelp(commandHelp.CommandHelp) InvalidCommandLineException(exceptions.InvalidCommandLineException)

Aggregations

CommandHelp (commandHelp.CommandHelp)1 InvalidCommandLineException (exceptions.InvalidCommandLineException)1 ConsoleReader (jline.console.ConsoleReader)1 StringsCompleter (jline.console.completer.StringsCompleter)1