Skip to content

Commit

Permalink
[improve][admin] Pretty print bookies racks-placement command output (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vineeth1995 authored Jun 8, 2023
1 parent 19face6 commit c39f7bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,21 @@ <T> void print(T item) {
if (item instanceof String) {
System.out.println(item);
} else {
System.out.println(writer.writeValueAsString(item));
prettyPrint(item);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}

<T> void prettyPrint(T item) {
try {
System.out.println(writer.writeValueAsString(item));
} catch (Exception e) {
throw new RuntimeException(e);
}
}

private static ObjectMapper mapper = ObjectMapperFactory.create();
private static ObjectWriter writer = mapper.writerWithDefaultPrettyPrinter();
private static Set<Character> sizeUnit = Sets.newHashSet('k', 'K', 'm', 'M', 'g', 'G', 't', 'T');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private class GetAll extends CliCommand {

@Override
void run() throws Exception {
print(getAdmin().bookies().getBookiesRackInfo());
prettyPrint(getAdmin().bookies().getBookiesRackInfo());
}
}

Expand Down

0 comments on commit c39f7bb

Please sign in to comment.