You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "PakhomovAlexander (via GitHub)" <gi...@apache.org> on 2024/08/25 20:48:14 UTC

[PR] IGNITE-22777 Improve CLI usability [ignite-3]

PakhomovAlexander opened a new pull request, #4280:
URL: https://github.com/apache/ignite-3/pull/4280

   Here is the example of usage help for `connect` command:
   
   ```
   USAGE
   ignite connect [OPTIONS] <nodeUrl>
   
   DESCRIPTION
   Connects to Ignite 3 node
   
   PARAMETERS * required parameter
   *     <nodeUrl>   URL of a node that will be used as a communication endpoint. It can be any node URL. If not set, then the default URL from the profile
                       settings will be used
   
   OPTIONS * required option
   * -u, --username=<username>
                     Username to connect to cluster
   * -p, --password=<password>
                     Password to connect to cluster
     -h, --help      Show help for the specified command
     -v, --verbose   Show additional information: logs, REST calls.This flag is useful for debugging
   ```


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-22777 Improve CLI usability [ignite-3]

Posted by "valepakh (via GitHub)" <gi...@apache.org>.
valepakh commented on code in PR #4280:
URL: https://github.com/apache/ignite-3/pull/4280#discussion_r1735825779


##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/TopLevelCliCommand.java:
##########
@@ -34,12 +35,14 @@
 /**
  * Top-level command that prints help and declares subcommands.
  */
-@Command(name = "ignite",
+@Command(
+        name = "ignite",
         versionProvider = VersionProvider.class,
         description = {
                 "Welcome to Ignite Shell alpha.",
                 "Run without command to enter interactive mode.",
-                ""},
+                ""
+        },

Review Comment:
   ```suggestion
                   ""},
   ```



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/TopLevelCliCommand.java:
##########
@@ -48,9 +51,10 @@
                 NodeCommand.class,
                 ClusterCommand.class,
                 RecoveryCommand.class
-        })
+        }
+)

Review Comment:
   ```suggestion
           })
   ```



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlReplTopLevelCliCommand.java:
##########
@@ -25,13 +36,25 @@
 /**
  * Top level SQL REPL command.
  */
-@Command(name = "",
-        description = {""},
+@Command(
+        name = "",
+        description = "",

Review Comment:
   ```suggestion
   @Command(name = "",
           description = {""},
   ```



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/help/SqlHelpCommand.java:
##########
@@ -30,13 +41,25 @@
 import picocli.CommandLine.Parameters;
 
 /** Help command in SQL repl mode. */
-@Command(name = "help",
+@Command(
+        name = "help",

Review Comment:
   ```suggestion
   @Command(name = "help",
   ```



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/BaseCommand.java:
##########
@@ -17,27 +17,52 @@
 
 package org.apache.ignite.internal.cli.commands;
 
+import static org.apache.ignite.internal.cli.commands.CommandConstants.ABBREVIATE_SYNOPSIS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.COMMAND_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.DESCRIPTION_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.HELP_OPTION_ORDER;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.OPTION_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.PARAMETER_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.REQUIRED_OPTION_MARKER;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SORT_OPTIONS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SORT_SYNOPSIS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SYNOPSIS_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.USAGE_HELP_AUTO_WIDTH;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.VERBOSE_OPTION_ORDER;
 import static org.apache.ignite.internal.cli.commands.Options.Constants.HELP_OPTION;
 import static org.apache.ignite.internal.cli.commands.Options.Constants.HELP_OPTION_DESC;
 import static org.apache.ignite.internal.cli.commands.Options.Constants.HELP_OPTION_SHORT;
 import static org.apache.ignite.internal.cli.commands.Options.Constants.VERBOSE_OPTION;
 import static org.apache.ignite.internal.cli.commands.Options.Constants.VERBOSE_OPTION_DESC;
 import static org.apache.ignite.internal.cli.commands.Options.Constants.VERBOSE_OPTION_SHORT;
 
+import picocli.CommandLine.Command;
 import picocli.CommandLine.Model.CommandSpec;
 import picocli.CommandLine.Option;
 import picocli.CommandLine.Spec;
 
 /**
  * Base class for commands.
  */
+@Command(
+        descriptionHeading = DESCRIPTION_HEADING,
+        optionListHeading = OPTION_LIST_HEADING,
+        synopsisHeading = SYNOPSIS_HEADING,
+        requiredOptionMarker = REQUIRED_OPTION_MARKER,
+        usageHelpAutoWidth = USAGE_HELP_AUTO_WIDTH,
+        sortOptions = SORT_OPTIONS,
+        sortSynopsis = SORT_SYNOPSIS,
+        abbreviateSynopsis = ABBREVIATE_SYNOPSIS,
+        commandListHeading = COMMAND_LIST_HEADING,
+        parameterListHeading = PARAMETER_LIST_HEADING
+)
 public abstract class BaseCommand {
     /** Help option specification. */
-    @Option(names = {HELP_OPTION, HELP_OPTION_SHORT}, usageHelp = true, description = HELP_OPTION_DESC)
+    @Option(names = {HELP_OPTION, HELP_OPTION_SHORT}, description = HELP_OPTION_DESC, order = HELP_OPTION_ORDER)

Review Comment:
   Will this work without `usageHelp = true`?



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/TopLevelCliReplCommand.java:
##########
@@ -26,12 +37,14 @@
 import org.apache.ignite.internal.cli.commands.sql.SqlReplCommand;
 import org.apache.ignite.internal.cli.commands.version.VersionCommand;
 import picocli.CommandLine;
+import picocli.CommandLine.Command;
 import picocli.shell.jline3.PicocliCommands;
 
 /**
  * Top-level command that just prints help.
  */
-@CommandLine.Command(name = "",
+@Command(
+        name = "",

Review Comment:
   ```suggestion
   @Command(name = "",
   ```



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/version/VersionCommand.java:
##########
@@ -25,7 +25,10 @@
 /**
  * Command that prints CLI version.
  */
-@Command(name = "version", description = "Prints CLI version")
+@Command(
+        name = "version",
+        description = "Prints CLI version"
+)

Review Comment:
   ```suggestion
   @Command(name = "version", description = "Prints CLI version")
   ```



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/TopLevelCliCommand.java:
##########
@@ -34,12 +35,14 @@
 /**
  * Top-level command that prints help and declares subcommands.
  */
-@Command(name = "ignite",
+@Command(
+        name = "ignite",

Review Comment:
   Let's revert these changes
   ```suggestion
   @Command(name = "ignite",
   ```



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-22777 Improve CLI usability [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4280:
URL: https://github.com/apache/ignite-3/pull/4280#discussion_r1732313181


##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/ExitCommand.java:
##########
@@ -17,13 +17,38 @@
 
 package org.apache.ignite.internal.cli.commands;
 
+import static org.apache.ignite.internal.cli.commands.CommandConstants.ABBREVIATE_SYNOPSIS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.COMMAND_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.DESCRIPTION_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.OPTION_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.PARAMETER_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.REQUIRED_OPTION_MARKER;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SORT_OPTIONS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SORT_SYNOPSIS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SYNOPSIS_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.USAGE_HELP_AUTO_WIDTH;
+
 import org.jline.reader.EndOfFileException;
 import picocli.CommandLine.Command;
 
 /**
  * Command to exit from app.
  */
-@Command(name = "exit", description = "Exit")
+@Command(
+        name = "exit",
+        description = "Exit",
+
+        descriptionHeading = DESCRIPTION_HEADING,
+        optionListHeading = OPTION_LIST_HEADING,

Review Comment:
   you can significantly decrease number of changes by using https://picocli.info/#_reuse



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-22777 Improve CLI usability [ignite-3]

Posted by "PakhomovAlexander (via GitHub)" <gi...@apache.org>.
PakhomovAlexander merged PR #4280:
URL: https://github.com/apache/ignite-3/pull/4280


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-22777 Improve CLI usability [ignite-3]

Posted by "valepakh (via GitHub)" <gi...@apache.org>.
valepakh commented on code in PR #4280:
URL: https://github.com/apache/ignite-3/pull/4280#discussion_r1731003979


##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlReplTopLevelCliCommand.java:
##########
@@ -31,7 +42,18 @@
                 ClearScreen.class,

Review Comment:
   Move `name` to the next line



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/config/NodeConfigCommand.java:
##########
@@ -28,6 +39,18 @@
                 NodeConfigShowCommand.class,

Review Comment:
   Move `name` to the next line



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/TopLevelCliCommand.java:
##########
@@ -48,7 +58,19 @@
                 NodeCommand.class,
                 ClusterCommand.class,
                 RecoveryCommand.class
-        })
+        },

Review Comment:
   Move `name` to the next line



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/TopLevelCliReplCommand.java:
##########
@@ -45,6 +56,19 @@
                 NodeReplCommand.class,

Review Comment:
   Move `name` to the next line



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cliconfig/profile/CliConfigProfileCommand.java:
##########
@@ -30,6 +41,18 @@
                 CliConfigProfileActivateCommand.class,

Review Comment:
   Move `name` to the next line



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/config/NodeConfigReplCommand.java:
##########
@@ -28,6 +39,18 @@
                 NodeConfigShowReplCommand.class,

Review Comment:
   Move `name` to the next line



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-22777 Improve CLI usability [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4280:
URL: https://github.com/apache/ignite-3/pull/4280#discussion_r1732313181


##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/ExitCommand.java:
##########
@@ -17,13 +17,38 @@
 
 package org.apache.ignite.internal.cli.commands;
 
+import static org.apache.ignite.internal.cli.commands.CommandConstants.ABBREVIATE_SYNOPSIS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.COMMAND_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.DESCRIPTION_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.OPTION_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.PARAMETER_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.REQUIRED_OPTION_MARKER;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SORT_OPTIONS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SORT_SYNOPSIS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SYNOPSIS_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.USAGE_HELP_AUTO_WIDTH;
+
 import org.jline.reader.EndOfFileException;
 import picocli.CommandLine.Command;
 
 /**
  * Command to exit from app.
  */
-@Command(name = "exit", description = "Exit")
+@Command(
+        name = "exit",
+        description = "Exit",
+
+        descriptionHeading = DESCRIPTION_HEADING,
+        optionListHeading = OPTION_LIST_HEADING,

Review Comment:
   you can significantly decrease nmber of changes by using picocli [default provider](https://picocli.info/#_default_provider)



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/ExitCommand.java:
##########
@@ -17,13 +17,38 @@
 
 package org.apache.ignite.internal.cli.commands;
 
+import static org.apache.ignite.internal.cli.commands.CommandConstants.ABBREVIATE_SYNOPSIS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.COMMAND_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.DESCRIPTION_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.OPTION_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.PARAMETER_LIST_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.REQUIRED_OPTION_MARKER;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SORT_OPTIONS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SORT_SYNOPSIS;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.SYNOPSIS_HEADING;
+import static org.apache.ignite.internal.cli.commands.CommandConstants.USAGE_HELP_AUTO_WIDTH;
+
 import org.jline.reader.EndOfFileException;
 import picocli.CommandLine.Command;
 
 /**
  * Command to exit from app.
  */
-@Command(name = "exit", description = "Exit")
+@Command(
+        name = "exit",
+        description = "Exit",
+
+        descriptionHeading = DESCRIPTION_HEADING,
+        optionListHeading = OPTION_LIST_HEADING,

Review Comment:
   you can significantly decrease number of changes by using picocli [default provider](https://picocli.info/#_default_provider)



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org