Copilot commented on code in PR #666:
URL:
https://github.com/apache/incubator-hugegraph-toolchain/pull/666#discussion_r2123683552
##########
hugegraph-loader/src/main/java/org/apache/hugegraph/loader/executor/LoadOptions.java:
##########
@@ -53,15 +54,17 @@ public class LoadOptions implements Serializable {
description = "The schema file path which to create manually")
public String schema;
- @Parameter(names = {"-g", "--graph"}, required = true, arity = 1,
- description = "The namespace of the graph to load into")
- public String graph;
+ @Parameter(names = {"-g", "--graph"},
+ arity = 1,
+ description = "The namespace of the graph to load into
(default: DEFAULT)")
+ public String graph = "DEFAULT";
Review Comment:
Update the description of the 'graph' parameter to clearly explain that a
default value of "DEFAULT" is used when no input is provided.
##########
hugegraph-loader/src/main/java/org/apache/hugegraph/loader/executor/LoadOptions.java:
##########
@@ -254,7 +256,16 @@ public static LoadOptions parseOptions(String[] args) {
JCommander commander = JCommander.newBuilder()
.addObject(options)
.build();
- commander.parse(args);
+ try {
+ commander.parse(args);
+ // Check param < 3 (required minimum num)
+ if (args.length < MINIMUM_REQUIRED_ARGS) {
+ LoadUtil.exitWithUsage(commander, Constants.EXIT_CODE_NORM);
+ }
Review Comment:
Consider checking if the minimum number of arguments is provided before
calling commander.parse(args) to avoid premature exceptions and improve clarity
of help output.
```suggestion
// Check param < 3 (required minimum num)
if (args.length < MINIMUM_REQUIRED_ARGS) {
LoadUtil.exitWithUsage(commander, Constants.EXIT_CODE_NORM);
}
try {
commander.parse(args);
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]