use of picocli.CommandLine in project neo4j by neo4j.
the class PushToCloudCommandTest method shouldAcceptDumpAsSource.
@Test
void shouldAcceptDumpAsSource() throws Exception {
// given
Copier targetCommunicator = mockedTargetCommunicator();
PushToCloudCommand command = command().copier(targetCommunicator).build();
// when
PushToCloudCommand.Uploader uploader = command.makeDumpUploader(this.dump);
String[] args = { "--dump", dump.toString(), "--bolt-uri", SOME_EXAMPLE_BOLT_URI };
new CommandLine(command).execute(args);
// then
verify(targetCommunicator).checkSize(anyBoolean(), any(), anyLong(), any());
verify(targetCommunicator).copy(anyBoolean(), any(), any(), eq(uploader.source), eq(false), any());
}
use of picocli.CommandLine in project neo4j by neo4j.
the class PushToCloudCommandTest method shouldUseNeo4jAsDefaultUsernameIfUserHitsEnter.
@Test
public void shouldUseNeo4jAsDefaultUsernameIfUserHitsEnter() throws Exception {
// given
Copier targetCommunicator = mockedTargetCommunicator();
PushToCloudConsole console = mock(PushToCloudConsole.class);
when(console.readLine(anyString(), anyString())).thenReturn("");
String defaultUsername = "neo4j";
String password = "super-secret-password";
PushToCloudCommand command = command().copier(targetCommunicator).console(console).build();
// when
String[] args = { "--dump", dump.toString(), "--bolt-uri", SOME_EXAMPLE_BOLT_URI, "--password", password.toString() };
new CommandLine(command).execute(args);
// then
verify(console).readLine("%s", format("Neo4j aura username (default: %s):", defaultUsername));
verify(targetCommunicator).authenticate(anyBoolean(), any(), eq(defaultUsername), eq(password.toCharArray()), anyBoolean());
verify(targetCommunicator).copy(anyBoolean(), any(), any(), any(), eq(false), any());
}
use of picocli.CommandLine in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class VSCommandBase method execute.
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) {
VSCommandFactory factory = new VSCommandFactory(sender);
CommandLine commandLine = new CommandLine(factory.create(cmdClass), factory);
registerConverters(commandLine, sender);
ChatWriter chatOut = new ChatWriter(sender);
commandLine.setOut(chatOut);
commandLine.setErr(chatOut);
args = VSCommandUtil.toProperArgs(args);
commandLine.execute(args);
}
use of picocli.CommandLine in project loinc2hpo by monarch-initiative.
the class Main method main.
public static void main(String[] args) {
if (args.length == 0) {
// if the user doesn't pass any command or option, add -h to show help
args = new String[] { "-h" };
}
CommandLine cline = new CommandLine(new Main()).addSubcommand("annotation-qc", new AnnotationQcCommand()).addSubcommand("stats", new LoincTableCoreStatsCommand());
cline.setToggleBooleanFlags(false);
int exitCode = cline.execute(args);
System.exit(exitCode);
}
use of picocli.CommandLine in project keycloak by keycloak.
the class Picocli method parseAndRun.
public static void parseAndRun(List<String> cliArgs) {
CommandLine cmd = createCommandLine(cliArgs);
if (Environment.isRebuildCheck()) {
int exitCode = runReAugmentationIfNeeded(cliArgs, cmd);
exitOnFailure(exitCode, cmd);
return;
}
int exitCode = cmd.execute(cliArgs.toArray(new String[0]));
exitOnFailure(exitCode, cmd);
}
Aggregations