xyz.luan.console.parser.config.HelpController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of console-parser Show documentation
Show all versions of console-parser Show documentation
Java library to easily parse console input directly into controller classes with elegance.
package xyz.luan.console.parser.config;
import java.util.List;
import xyz.luan.console.parser.Context;
import xyz.luan.console.parser.Controller;
import xyz.luan.console.parser.actions.Action;
import xyz.luan.console.parser.actions.ActionRef;
import xyz.luan.console.parser.actions.Arg;
import xyz.luan.console.parser.call.CallResult;
import xyz.luan.console.parser.callable.ActionCall;
import xyz.luan.console.parser.callable.Callable;
import xyz.luan.console.parser.callable.Pattern;
public class HelpController extends Controller {
@Action("list")
public CallResult list() {
return context.getParser().listCallables(console);
}
@Action("show")
public CallResult show(@Arg("command") String command) {
return context.getParser().listCallables(console, command);
}
public static void defaultActions(String name, List callables) {
callables.add(new ActionCall(name + ":list", ":help", "List all callables"));
callables.add(new ActionCall(new ActionRef(name, "show"), new Pattern(":help command", true), "List all callables starting with command"));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy