From 5e9919e7a44ff9e9591bf551a4d84407ef649a75 Mon Sep 17 00:00:00 2001 From: Lord of Abyss <103809695+Abyss-lord@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:53:03 +0800 Subject: [PATCH] [#5853] improvement(CLI): Make the entity and arguments case-insensitive (#5898) ### What changes were proposed in this pull request? Make the entity and arguments case-insensitive. ### Why are the changes needed? Fix: #5853 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? ```bash bin/gcli.sh metalake List # output: correct output bin/gcli.sh Metalake list # output: correct output bin/gcli.sh mEtalake List # output: correct output ``` --- clients/cli/src/main/java/org/apache/gravitino/cli/Main.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clients/cli/src/main/java/org/apache/gravitino/cli/Main.java b/clients/cli/src/main/java/org/apache/gravitino/cli/Main.java index 8b610511f91..4707da16d21 100644 --- a/clients/cli/src/main/java/org/apache/gravitino/cli/Main.java +++ b/clients/cli/src/main/java/org/apache/gravitino/cli/Main.java @@ -19,6 +19,7 @@ package org.apache.gravitino.cli; +import java.util.Locale; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; @@ -70,7 +71,7 @@ protected static String resolveCommand(CommandLine line) { String[] args = line.getArgs(); if (args.length == 2) { - String action = args[1]; + String action = args[1].toLowerCase(Locale.ENGLISH); if (CommandActions.isValidCommand(action)) { return action; } @@ -96,7 +97,7 @@ protected static String resolveEntity(CommandLine line) { String[] args = line.getArgs(); if (args.length >= 1) { - String entity = args[0]; + String entity = args[0].toLowerCase(Locale.ENGLISH); if (CommandEntities.isValidEntity(entity)) { return entity; } else {