use of net.morimekta.console.args.ArgumentParser 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;
}
use of net.morimekta.console.args.ArgumentParser in project providence by morimekta.
the class CommonOptions method getArgumentParser.
public ArgumentParser getArgumentParser(String prog, String description) throws IOException {
ArgumentParser parser = new ArgumentParser(prog, Utils.getVersionString(), description, getArgumentOptions());
parser.add(new Flag("--help", "h?", "This help listing.", this::setHelp));
parser.add(new Flag("--verbose", "V", "Show verbose output and error messages.", this::setVerbose));
parser.add(new Flag("--version", "v", "Show program version.", this::setVersion));
parser.add(new Option("--rc", null, "FILE", "Providence RC to use", file(this::setRc), "~" + File.separator + ".pvdrc"));
return parser;
}
use of net.morimekta.console.args.ArgumentParser in project providence by morimekta.
the class Help method parser.
@Override
public ArgumentParser parser(ArgumentParser parent) {
ArgumentParser parser = new ArgumentParser(parent.getProgram() + " [...] help", parent.getVersion(), "");
parser.add(new Argument("cmd", "Command to show help for", this::setCommand, null, null, false, false, false));
return parser;
}
use of net.morimekta.console.args.ArgumentParser in project providence by morimekta.
the class Resolve method parser.
@Override
public ArgumentParser parser(ArgumentParser parent) {
ArgumentParser parser = new ArgumentParser(parent.getProgram() + " [...] resolve", parent.getVersion(), "Resolve config files to final config message.");
parser.add(new Option("--format", "f", "fmt", "the output format", this::setSerializer, "pretty"));
parser.add(new Argument("file", "Config files to resolve", Parser.file(this::addFile), null, null, true, true, false));
return parser;
}
use of net.morimekta.console.args.ArgumentParser in project providence by morimekta.
the class Validate method parser.
@Override
public ArgumentParser parser(ArgumentParser parent) {
ArgumentParser parser = new ArgumentParser(parent.getProgram() + " [...] validate", parent.getVersion(), "Verify content of config files, also checking includes");
parser.add(new Argument("file", "Config files to validate", Parser.file(this::addFile), null, null, true, true, false));
return parser;
}
Aggregations