use of com.facebook.buck.rage.UserInput in project buck by facebook.
the class DoctorCommand method runWithoutHelp.
@Override
public int runWithoutHelp(CommandRunnerParams params) throws IOException, InterruptedException {
ProjectFilesystem filesystem = params.getCell().getFilesystem();
BuildLogHelper buildLogHelper = new BuildLogHelper(filesystem, params.getObjectMapper());
UserInput userInput = new UserInput(params.getConsole().getStdOut(), new BufferedReader(new InputStreamReader(params.getStdIn())));
DoctorReportHelper helper = new DoctorReportHelper(params.getCell().getFilesystem(), userInput, params.getConsole(), params.getObjectMapper(), params.getBuckConfig().getView(DoctorConfig.class));
Optional<BuildLogEntry> entry = helper.promptForBuild(new ArrayList<>(buildLogHelper.getBuildLogs()));
if (!entry.isPresent()) {
params.getConsole().getStdOut().println("No interesting commands found in buck-out/log.");
return 0;
}
Optional<DefectSubmitResult> rageResult = generateRageReport(params, userInput, entry.get());
if (!rageResult.isPresent()) {
params.getConsole().printErrorText("Failed to generate report to send.");
return 1;
}
DoctorEndpointRequest request = helper.generateEndpointRequest(entry.get(), rageResult.get());
DoctorEndpointResponse response = helper.uploadRequest(request);
helper.presentResponse(response);
helper.presentRageResult(rageResult);
return 0;
}
Aggregations