This is an automated email from the ASF dual-hosted git repository.
nicoloboschi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 9f202b0dee Optimize bookie usage information while using command line
option --help (#4241)
9f202b0dee is described below
commit 9f202b0dee50e41bd78e53e6e06995eabb17a771
Author: Kang Zou <[email protected]>
AuthorDate: Mon Apr 22 17:28:13 2024 +0800
Optimize bookie usage information while using command line option --help
(#4241)
---
.../main/java/org/apache/bookkeeper/server/Main.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
index decc32c24a..3eff455a84 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
@@ -109,12 +109,13 @@ public class Main {
BasicParser parser = new BasicParser();
CommandLine cmdLine = parser.parse(BK_OPTS, args);
+ ServerConfiguration conf = new ServerConfiguration();
+
if (cmdLine.hasOption('h')) {
- throw new IllegalArgumentException();
+ conf.setProperty("help", true);
+ return conf;
}
- ServerConfiguration conf = new ServerConfiguration();
-
if (cmdLine.hasOption('c')) {
String confFile = cmdLine.getOptionValue("c");
loadConfFile(conf, confFile);
@@ -210,6 +211,11 @@ public class Main {
return ExitCode.INVALID_CONF;
}
+ if (conf.getBoolean("help", false)) {
+ printUsage();
+ return ExitCode.OK;
+ }
+
// 1. building the component stack:
LifecycleComponent server;
try {
@@ -244,6 +250,11 @@ public class Main {
printUsage();
throw iae;
}
+
+ if (conf.getBoolean("help", false)) {
+ return conf;
+ }
+
String hello = String.format(
"Hello, I'm your bookie, bookieId is %1$s, listening on port %2$s.
Metadata service uri is %3$s."
+ " Journals are in %4$s. Ledgers are stored in %5$s. Indexes
are stored in %6$s.",