use of com.google.devtools.build.remote.client.RemoteClientOptions.ShowActionCommand in project tools_remote by bazelbuild.
the class RemoteClient method selectAndPerformCommand.
public static void selectAndPerformCommand(String[] args) throws Exception {
AuthAndTLSOptions authAndTlsOptions = new AuthAndTLSOptions();
RemoteOptions remoteOptions = new RemoteOptions();
RemoteClientOptions remoteClientOptions = new RemoteClientOptions();
LsCommand lsCommand = new LsCommand();
LsOutDirCommand lsOutDirCommand = new LsOutDirCommand();
GetDirCommand getDirCommand = new GetDirCommand();
GetOutDirCommand getOutDirCommand = new GetOutDirCommand();
CatCommand catCommand = new CatCommand();
FailedActionsCommand failedActionsCommand = new FailedActionsCommand();
ShowActionCommand showActionCommand = new ShowActionCommand();
ShowActionResultCommand showActionResultCommand = new ShowActionResultCommand();
PrintLogCommand printLogCommand = new PrintLogCommand();
RunCommand runCommand = new RunCommand();
JCommander optionsParser = JCommander.newBuilder().programName("remote_client").addObject(authAndTlsOptions).addObject(remoteOptions).addObject(remoteClientOptions).addCommand("ls", lsCommand).addCommand("lsoutdir", lsOutDirCommand).addCommand("getdir", getDirCommand).addCommand("getoutdir", getOutDirCommand).addCommand("cat", catCommand).addCommand("show_action", showActionCommand, "sa").addCommand("show_action_result", showActionResultCommand, "sar").addCommand("printlog", printLogCommand).addCommand("run", runCommand).addCommand("failed_actions", failedActionsCommand).build();
try {
optionsParser.parse(args);
} catch (ParameterException e) {
System.err.println("Unable to parse options: " + e.getLocalizedMessage());
optionsParser.usage();
System.exit(1);
}
if (remoteClientOptions.help) {
optionsParser.usage();
return;
}
if (optionsParser.getParsedCommand() == null) {
System.err.println("No command specified.");
optionsParser.usage();
System.exit(1);
}
switch(optionsParser.getParsedCommand()) {
case "printlog":
doPrintLog(remoteClientOptions.grpcLog, printLogCommand);
break;
case "ls":
doLs(lsCommand, makeClientWithOptions(remoteOptions, authAndTlsOptions));
break;
case "lsoutdir":
doLsOutDir(lsOutDirCommand, makeClientWithOptions(remoteOptions, authAndTlsOptions));
break;
case "getdir":
doGetDir(getDirCommand, makeClientWithOptions(remoteOptions, authAndTlsOptions));
break;
case "getoutdir":
doGetOutDir(getOutDirCommand, makeClientWithOptions(remoteOptions, authAndTlsOptions));
break;
case "cat":
doCat(catCommand, makeClientWithOptions(remoteOptions, authAndTlsOptions));
break;
case "show_action":
doShowAction(showActionCommand, makeClientWithOptions(remoteOptions, authAndTlsOptions));
break;
case "show_action_result":
doShowActionResult(showActionResultCommand, makeClientWithOptions(remoteOptions, authAndTlsOptions));
break;
case "run":
doRun(remoteClientOptions.grpcLog, runCommand, makeClientWithOptions(remoteOptions, authAndTlsOptions));
break;
case "failed_actions":
doFailedActions(remoteClientOptions.grpcLog, failedActionsCommand);
break;
default:
throw new IllegalArgumentException("Unknown command.");
}
}
Aggregations