use of picocli.CommandLine in project vcell by virtualcell.
the class VCellSbmlSimCLI method parse.
void parse(String[] args) {
new CommandLine(this).parse(args);
String parsedCommand = this.command;
if (parsedCommand == null || Command.valueOf(parsedCommand) == null) {
throw new RuntimeException("command '" + parsedCommand + "' not found");
}
this.cmd = Command.valueOf(parsedCommand);
}
use of picocli.CommandLine in project drools by kiegroup.
the class ChineseLunarYearsTest method testCLI.
@Test
public void testCLI() throws Exception {
File tempFile = File.createTempFile("xls2dmn", ".dmn");
final DMNRuntime dmnRuntime = getRuntime(new CommandLine(new App())::execute, tempFile, new String[] { "src/test/resources/ChineseLunarYears.xlsx", tempFile.toString() });
DMNModel dmnModel = dmnRuntime.getModels().get(0);
DMNContext dmnContext = dmnRuntime.newContext();
dmnContext.set("Date", LocalDate.of(2021, 4, 1));
DMNResult dmnResult = dmnRuntime.evaluateAll(dmnModel, dmnContext);
LOG.debug("{}", dmnResult);
assertThat(DMNRuntimeUtil.formatMessages(dmnResult.getMessages()), dmnResult.hasErrors(), is(false));
assertThat(dmnResult.getDecisionResultByName("Chinese Year").getResult(), is("Golden Ox"));
}
use of picocli.CommandLine in project TOSCAna by StuPro-TOSCAna.
the class CliMain method main.
public void main(String[] args) {
// Activate ANSI on Windows
AnsiConsole.systemInstall();
System.setProperty("picocli.ansi", "true");
// System Property gets set here, because picocli.trace must be set before CommandLine starts
String input = String.join("", args);
if (input.endsWith("-m")) {
System.setProperty("picocli.trace", "DEBUG");
} else if (input.endsWith("-v")) {
System.setProperty("picocli.trace", "INFO");
}
CommandLine commandLine = new CommandLine(new CliMain(), new CliPropertiesFactory(apiController));
commandLine.parseWithHandler(new CommandLine.RunLast(), System.err, args);
AnsiConsole.systemUninstall();
}
use of picocli.CommandLine in project aion by aionnetwork.
the class EditCli method printUsage.
/**
* Prints the usage message for this command
*/
public static void printUsage(PrintStream out, EditCli instance) {
CommandLine parser = new CommandLine(instance);
String usage = parser.getUsageMessage();
// the additional dots are added for the styling extra characters
usage = usage.replaceAll("=....<logger", " <logger");
out.println(usage);
}
use of picocli.CommandLine in project aion by aionnetwork.
the class CliTest method testFailedParse.
@Test(expected = RuntimeException.class)
@Parameters(method = "parametersForTestFailedParse")
public void testFailedParse(String[] options) {
Arguments args = new Arguments();
EditCli editCli = new EditCli();
CommandLine parser = new CommandLine(args).addSubcommand(editCli);
parser.parseArgs(options).subcommand();
editCli.checkOptions();
}
Aggregations