Search in sources :

Example 1 with Resolve

use of net.morimekta.providence.tools.config.cmd.Resolve 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;
}
Also used : ArgumentParser(net.morimekta.console.args.ArgumentParser) Parser.dir(net.morimekta.console.util.Parser.dir) SubCommandSet(net.morimekta.console.args.SubCommandSet) CommonOptions(net.morimekta.providence.tools.common.CommonOptions) IOException(java.io.IOException) Command(net.morimekta.providence.tools.config.cmd.Command) Help(net.morimekta.providence.tools.config.cmd.Help) File(java.io.File) ArrayList(java.util.ArrayList) Validate(net.morimekta.providence.tools.config.cmd.Validate) Flag(net.morimekta.console.args.Flag) List(java.util.List) STTY(net.morimekta.console.util.STTY) Resolve(net.morimekta.providence.tools.config.cmd.Resolve) Option(net.morimekta.console.args.Option) SubCommand(net.morimekta.console.args.SubCommand) Help(net.morimekta.providence.tools.config.cmd.Help) Option(net.morimekta.console.args.Option) ArgumentParser(net.morimekta.console.args.ArgumentParser) Flag(net.morimekta.console.args.Flag)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ArgumentParser (net.morimekta.console.args.ArgumentParser)1 Flag (net.morimekta.console.args.Flag)1 Option (net.morimekta.console.args.Option)1 SubCommand (net.morimekta.console.args.SubCommand)1 SubCommandSet (net.morimekta.console.args.SubCommandSet)1 Parser.dir (net.morimekta.console.util.Parser.dir)1 STTY (net.morimekta.console.util.STTY)1 CommonOptions (net.morimekta.providence.tools.common.CommonOptions)1 Command (net.morimekta.providence.tools.config.cmd.Command)1 Help (net.morimekta.providence.tools.config.cmd.Help)1 Resolve (net.morimekta.providence.tools.config.cmd.Resolve)1 Validate (net.morimekta.providence.tools.config.cmd.Validate)1