use of net.morimekta.console.args.SubCommand in project providence by morimekta.
the class ConfigOptions method getArgumentParser.
@Override
public ArgumentParser getArgumentParser(String prog, String description) throws IOException {
ArgumentParser parser = super.getArgumentParser(prog, description);
parser.add(new Flag("--strict", "S", "Parse config strictly", this::setStrict, false));
parser.add(new Option("--include", "I", "dir", "Read config definitions from these directories.", dir(includes::add), null, true, false, false));
commandSet = new SubCommandSet<>("cmd", "Config action.", this::setCommand, null, true, getArgumentOptions());
commandSet.add(new SubCommand<>("help", "Show help for sub-commands.", false, () -> new Help(commandSet, parser), cmd -> cmd.parser(parser)));
commandSet.add(new SubCommand<>("resolve", "Resolve the resulting config.", false, Resolve::new, cmd -> cmd.parser(parser), "p", "pr"));
commandSet.add(new SubCommand<>("validate", "Validate the files, print error if not valid.", false, Validate::new, cmd -> cmd.parser(parser)));
parser.add(commandSet);
return parser;
}
Aggregations