use of net.morimekta.providence.tools.generator.options.HelpOption in project providence by morimekta.
the class GeneratorOptions method getArgumentParser.
public ArgumentParser getArgumentParser(String prog, String description) throws IOException {
ArgumentOptions opts = ArgumentOptions.defaults(tty).withMaxUsageWidth(120);
ArgumentParser parser = new ArgumentParser(prog, Utils.getVersionString(), description, opts);
parser.add(new Option("--gen", "g", "generator", "Generate files for this language spec.", new GeneratorSpecParser(this::getFactories).andApply(this::setGenerator)));
parser.add(new HelpOption("--help", "h?", "Show this help or about language.", this::getFactories, 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"));
parser.add(new Option("--include", "I", "dir", "Allow includes of files in directory", dir(this::addInclude), null, true, false, false));
parser.add(new Option("--out", "o", "dir", "Output directory", outputDir(this::setOut), "${PWD}"));
parser.add(new Flag("--require-field-id", null, "Require all fields to have a defined ID", this::setRequireFieldId));
parser.add(new Flag("--require-enum-value", null, "Require all enum values to have a defined ID", this::setRequireEnumValue));
parser.add(new Flag("--allow-language-reserved-names", null, "Allow language-reserved words in type names", this::setAllowLanguageReservedNames, true));
parser.add(new Flag("--no-language-reserved-names", null, "Do not allow language-reserved words in type names", b -> this.setAllowLanguageReservedNames(!b)));
parser.add(new Flag("--skip-if-missing-namespace", "N", "Skip generation for files without requested namespace", this::setSkipIfMissingNamespace));
parser.add(new Option("--add-generator", null, "FILE", "Add extra generator .jar file", file(extraGenerators::add)));
parser.add(new Argument("file", "Files to compile.", file(this::addFile), null, null, true, true, false));
return parser;
}
Aggregations