public class AeshExample {
public static void main(String[] args) throws CommandLineParserException {
CommandBuilder fooCommand = new CommandBuilder()
.name("foo")
.description("fooing")
.addOption(new ProcessedOptionBuilder()
.name("bar")
.addDefaultValue("en 1 0")
.addDefaultValue("to 2 0")
.fieldName("bar")
.type(String.class)
.renderer(new BlueBoldRenderer())
.create())
.addOption(new ProcessedOptionBuilder()
.name("foo")
.fieldName("foo")
.type(String.class)
.create())
.command(FooCommand.class);
/*
ProcessedCommand fooCommand = new ProcessedCommandBuilder()
.name("foo")
.description("fooing")
.addOption(new ProcessedOptionBuilder()
.name("bar")
.addDefaultValue("en 1 0")
.addDefaultValue("to 2 0")
.fieldName("bar")
.type(String.class)
.renderer(new BlueBoldRenderer())
.create())
.addOption(new ProcessedOptionBuilder()
.name("foo")
.fieldName("foo")
.type(String.class)
.create())
.create();
*/
SettingsBuilder builder = new SettingsBuilder().logging(true);
builder.enableMan(true)
.readInputrc(false);
/*
.interruptHook(new InterruptHook() {
@Override
public void handleInterrupt(Console console) {
console.getShell().out().println("^C");
console.clearBufferAndDisplayPrompt();
}
});
*/
Settings settings = builder.create();
CommandRegistry registry = new AeshCommandRegistryBuilder()
.command(ExitCommand.class)
.command(fooCommand.generate())
.command(LsCommand.class)
.command(TestConsoleCommand.class)
.command(PromptCommand.class)
.command(RunCommand.class)
.command(GroupCommand.class)