Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5924] improvement(CLI): fix cli list command produce no outputs #5942

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void handle() {
exitWithError(exp.getMessage());
}

String all = String.join(",", tags);
String all = tags.length == 0 ? "No tags exist." : String.join(",", tags);

System.out.println(all.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ public void handle() {
try {
GravitinoClient client = buildClient(metalake);
catalogs = client.listCatalogsInfo();
output(catalogs);
if (catalogs.length == 0) {
System.out.println("No catalogs exists.");
Abyss-lord marked this conversation as resolved.
Show resolved Hide resolved
} else {
output(catalogs);
}
Abyss-lord marked this conversation as resolved.
Show resolved Hide resolved
} catch (NoSuchMetalakeException err) {
exitWithError(ErrorMessages.UNKNOWN_METALAKE);
} catch (Exception exp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void handle() {
exitWithError(exp.getMessage());
}

String all = Joiner.on(",").join(filesets);
String all = filesets.length == 0 ? "No filesets exists." : Joiner.on(",").join(filesets);
Abyss-lord marked this conversation as resolved.
Show resolved Hide resolved

System.out.println(all.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void handle() {
exitWithError(exp.getMessage());
}

String all = String.join(",", groups);
String all = groups.length == 0 ? "No groups exists." : String.join(",", groups);
Abyss-lord marked this conversation as resolved.
Show resolved Hide resolved

System.out.println(all.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public void handle() {
try {
GravitinoAdminClient client = buildAdminClient();
metalakes = client.listMetalakes();
output(metalakes);
if (metalakes.length == 0) {
System.out.println("No metalakes exists.");
Abyss-lord marked this conversation as resolved.
Show resolved Hide resolved
} else {
output(metalakes);
}
Abyss-lord marked this conversation as resolved.
Show resolved Hide resolved
} catch (Exception exp) {
exitWithError(exp.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void handle() {
exitWithError(exp.getMessage());
}

String all = String.join(",", roles);
String all = roles.length == 0 ? "No roles exists." : String.join(",", roles);

System.out.println(all.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void handle() {
exitWithError(exp.getMessage());
}

String all = Joiner.on(",").join(schemas);
String all = schemas.length == 0 ? "No schemas exists." : Joiner.on(",").join(schemas);
Abyss-lord marked this conversation as resolved.
Show resolved Hide resolved

System.out.println(all.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public void handle() {
tableNames.add(tables[i].name());
}

String all = Joiner.on(System.lineSeparator()).join(tableNames);
String all =
tableNames.isEmpty()
? "No tables exists."
Abyss-lord marked this conversation as resolved.
Show resolved Hide resolved
: Joiner.on(System.lineSeparator()).join(tableNames);

System.out.println(all.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ public void handle() {
exitWithError(exp.getMessage());
}

String all = Joiner.on(",").join(Arrays.stream(topics).map(topic -> topic.name()).iterator());
String all =
topics.length == 0
? "No topics exists."
Abyss-lord marked this conversation as resolved.
Show resolved Hide resolved
: Joiner.on(",").join(Arrays.stream(topics).map(topic -> topic.name()).iterator());
System.out.println(all);
}
}
Loading