sunxiaojian commented on code in PR #5641:
URL: https://github.com/apache/gravitino/pull/5641#discussion_r1855404045
##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -444,44 +449,66 @@ protected void handleTagCommand() {
}
} else if (CommandActions.CREATE.equals(command)) {
String comment = line.getOptionValue(GravitinoOptions.COMMENT);
- new CreateTag(url, ignore, metalake, tag, comment).handle();
+ new CreateTag(url, ignore, metalake, tags, comment).handle();
} else if (CommandActions.DELETE.equals(command)) {
boolean force = line.hasOption(GravitinoOptions.FORCE);
- new DeleteTag(url, ignore, force, metalake, tag).handle();
+ new DeleteTag(url, ignore, force, metalake, tags).handle();
} else if (CommandActions.SET.equals(command)) {
String property = line.getOptionValue(GravitinoOptions.PROPERTY);
String value = line.getOptionValue(GravitinoOptions.VALUE);
-
if (name == null && property != null && value != null) {
- new SetTagProperty(url, ignore, metalake, tag, property,
value).handle();
+ if (tags.length > 1) {
+ System.err.println(ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+ return;
+ }
+ new SetTagProperty(url, ignore, metalake, tags[0], property,
value).handle();
} else if (name != null && property == null && value == null) {
- new TagEntity(url, ignore, metalake, name, tag).handle();
+ new TagEntity(url, ignore, metalake, name, tags).handle();
} else {
System.err.println(ErrorMessages.INVALID_SET_COMMAND);
}
} else if (CommandActions.REMOVE.equals(command)) {
String property = line.getOptionValue(GravitinoOptions.PROPERTY);
if (property != null) {
- new RemoveTagProperty(url, ignore, metalake, tag, property).handle();
+ if (tags.length > 1) {
+ System.err.println(ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+ return;
+ }
+ new RemoveTagProperty(url, ignore, metalake, tags[0],
property).handle();
} else if (name != null) {
- new UntagEntity(url, ignore, metalake, name, tag).handle();
+ new UntagEntity(url, ignore, metalake, name, tags).handle();
} else {
System.err.println(ErrorMessages.INVALID_REMOVE_COMMAND);
}
} else if (CommandActions.PROPERTIES.equals(command)) {
- new ListTagProperties(url, ignore, metalake, tag).handle();
+ new ListTagProperties(url, ignore, metalake, tags[0]).handle();
} else if (CommandActions.UPDATE.equals(command)) {
if (line.hasOption(GravitinoOptions.COMMENT)) {
String comment = line.getOptionValue(GravitinoOptions.COMMENT);
- new UpdateTagComment(url, ignore, metalake, tag, comment).handle();
+ new UpdateTagComment(url, ignore, metalake, tags[0], comment).handle();
}
if (line.hasOption(GravitinoOptions.RENAME)) {
String newName = line.getOptionValue(GravitinoOptions.RENAME);
- new UpdateTagName(url, ignore, metalake, tag, newName).handle();
+ new UpdateTagName(url, ignore, metalake, tags[0], newName).handle();
}
}
}
+ private boolean validateMultipleTagOption(String[] tags) {
+ switch (command) {
+ case CommandActions.CREATE:
+ case CommandActions.DELETE:
+ case CommandActions.SET:
+ case CommandActions.REMOVE:
+ return true;
+ default:
+ if (tags.length > 1) {
+ return false;
+ }
+ return true;
Review Comment:
> if tags is of length 0, this returns true.
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]