if (json) {
showJsonStatuses(out, hostPattern, jobIds, statuses);
return 0;
}
final JobStatusTable table = jobStatusTable(out, full);
final boolean noHostMatchedEver = showStatusesForHosts(hostPattern, jobIds, statuses,
new HostStatusDisplayer() {
@Override
public void matchedStatus(JobStatus jobStatus, Iterable<String> matchingHosts,
Map<String, TaskStatus> taskStatuses) {
displayTask(full, table, jobStatus.getJob().getId(), jobStatus, taskStatuses,
matchingHosts);
}
});
if (noHostMatchedEver) {
out.printf("host pattern %s matched no hosts%n", hostPattern);
return 1;
}
table.print();
return 0;
}