Skip to content

Commit

Permalink
[apache#5746] feat(CLI): Support table format output for Audit command
Browse files Browse the repository at this point in the history
Fix the header.
  • Loading branch information
Abyss-lord committed Feb 24, 2025
1 parent 98f7647 commit 2355c13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,9 @@ public AuditTableFormat(CommandContext context) {
@Override
public String getOutput(Audit audit) {
Column columnCreator = new Column(context, "creator");
Column columnCreateTime = new Column(context, "create time");
Column columnModified = new Column(context, "modified");
Column columnModifyTime = new Column(context, "modify time");
Column columnCreateTime = new Column(context, "creation at");
Column columnModified = new Column(context, "modifier");
Column columnModifyTime = new Column(context, "modified at");

columnCreator.addCell(audit.creator());
columnCreateTime.addCell(audit.createTime() == null ? "N/A" : audit.createTime().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void testAuditWithTableFormat() {
String output = new String(outContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals(
"+-----------+--------------------------+-----------+--------------------------+\n"
+ "| Creator | Create time | Modified | Modify time |\n"
+ "| Creator | Creation at | Modifier | Modified at |\n"
+ "+-----------+--------------------------+-----------+--------------------------+\n"
+ "| demo_user | 2021-01-20T02:51:51.111Z | demo_user | 2021-01-20T02:51:51.111Z |\n"
+ "+-----------+--------------------------+-----------+--------------------------+",
Expand All @@ -410,7 +410,7 @@ void testAuditWithTableFormatWithNullValues() {
String output = new String(outContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals(
"+-----------+-------------+----------+-------------+\n"
+ "| Creator | Create time | Modified | Modify time |\n"
+ "| Creator | Creation at | Modifier | Modified at |\n"
+ "+-----------+-------------+----------+-------------+\n"
+ "| demo_user | N/A | N/A | N/A |\n"
+ "+-----------+-------------+----------+-------------+",
Expand Down

0 comments on commit 2355c13

Please sign in to comment.