Skip to content

Commit

Permalink
[#5831] fix(CLI): Fix CLi gives unexpected output when setting a tag
Browse files Browse the repository at this point in the history
fix some problems according to reviewer.
  • Loading branch information
Abyss-lord committed Dec 18, 2024
1 parent d7883ca commit 2857789
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public class ErrorMessages {
public static final String UNKNOWN_TABLE = "Unknown table name.";
public static final String MALFORMED_NAME = "Malformed entity name.";
public static final String MISSING_NAME = "Missing --name option.";
public static final String MISSING_ENTITY =
"Unable to determine the entity. Please specify one" + " using the --name option.";
public static final String METALAKE_EXISTS = "Metalake already exists.";
public static final String CATALOG_EXISTS = "Catalog already exists.";
public static final String SCHEMA_EXISTS = "Schema already exists.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ protected void handleTagCommand() {
newSetTagProperty(url, ignore, metalake, getOneTag(tags), property, value).handle();
} else if (property == null && value == null) {
if (!hasEntity(name)) {
showEntityUndefinedMessage();
System.err.println(ErrorMessages.MALFORMED_NAME);
return;
}
newTagEntity(url, ignore, metalake, name, tags).handle();
Expand All @@ -515,7 +515,7 @@ protected void handleTagCommand() {
if (!isTag) {
boolean force = line.hasOption(GravitinoOptions.FORCE);
if (!hasEntity(name)) {
showEntityUndefinedMessage();
System.err.println(ErrorMessages.MALFORMED_NAME);
return;
}
newRemoveAllTags(url, ignore, metalake, name, force).handle();
Expand All @@ -525,7 +525,7 @@ protected void handleTagCommand() {
newRemoveTagProperty(url, ignore, metalake, getOneTag(tags), property).handle();
} else {
if (!hasEntity(name)) {
showEntityUndefinedMessage();
System.err.println(ErrorMessages.MALFORMED_NAME);
return;
}
newUntagEntity(url, ignore, metalake, name, tags).handle();
Expand Down Expand Up @@ -833,9 +833,6 @@ private boolean hasEntity(FullName name) {
&& Objects.isNull(name.getTableName()));
}

private void showEntityUndefinedMessage() {
System.err.println(ErrorMessages.MISSING_ENTITY);
}
/**
* Retrieves the Gravitinno URL from the command line options or the GRAVITINO_URL environment
* variable or the Gravitio config file.
Expand Down

0 comments on commit 2857789

Please sign in to comment.