Abyss-lord commented on code in PR #6535:
URL: https://github.com/apache/gravitino/pull/6535#discussion_r1971158694


##########
clients/cli/src/main/java/org/apache/gravitino/cli/commands/ManageCatalog.java:
##########
@@ -16,41 +16,63 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.gravitino.cli.commands;
 
+import org.apache.commons.cli.CommandLine;
 import org.apache.gravitino.cli.CommandContext;
 import org.apache.gravitino.cli.ErrorMessages;
+import org.apache.gravitino.cli.GravitinoOptions;
 import org.apache.gravitino.client.GravitinoAdminClient;
 import org.apache.gravitino.client.GravitinoClient;
 import org.apache.gravitino.exceptions.MetalakeNotInUseException;
 import org.apache.gravitino.exceptions.NoSuchCatalogException;
 import org.apache.gravitino.exceptions.NoSuchMetalakeException;
 
-/** Enable catalog. */
-public class CatalogEnable extends Command {
+/** Disable or enable a catalog. */
+public class ManageCatalog extends Command {
   private final String metalake;
   private final String catalog;
+  private final CommandLine line;
   private final boolean enableMetalake;
 
   /**
-   * Enable catalog
+   * Constrcut a new instance of the {@code ManageCatalog}.
    *
-   * @param context The command context.
-   * @param metalake The name of the metalake.
-   * @param catalog The name of the catalog.
-   * @param enableMetalake Whether to enable it's metalake
+   * @param context the command context.
+   * @param metalake the metalake name.
+   * @param catalog the catalog name.
    */
-  public CatalogEnable(
-      CommandContext context, String metalake, String catalog, boolean 
enableMetalake) {
+  public ManageCatalog(CommandContext context, String metalake, String 
catalog) {
     super(context);
     this.metalake = metalake;
     this.catalog = catalog;
-    this.enableMetalake = enableMetalake;
+    this.line = context.line();
+    this.enableMetalake = line.hasOption(GravitinoOptions.ALL);
   }
 
-  /** Enable catalog. */
+  /** Disable or enable a catalog. */
   @Override
   public void handle() {
+    if (line.hasOption(GravitinoOptions.ENABLE)) {
+      enableCatalog();
+    } else if (line.hasOption(GravitinoOptions.DISABLE)) {
+      disableCatalog();
+    }
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public Command validate() {
+    if (line.hasOption(GravitinoOptions.ENABLE) && 
line.hasOption(GravitinoOptions.DISABLE)) {
+      exitWithError(ErrorMessages.INVALID_ENABLE_DISABLE);

Review Comment:
   @tengqm Thank you , I just change the error message.



-- 
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]

Reply via email to