Skip to content

Commit

Permalink
Optimize bookie usage information while using command line option --h…
Browse files Browse the repository at this point in the history
…elp (#4241)
  • Loading branch information
tmzk1005 authored Apr 22, 2024
1 parent 55ffbd7 commit 9f202b0
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ private static ServerConfiguration parseArgs(String[] args)
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);
Expand Down Expand Up @@ -210,6 +211,11 @@ static int doMain(String[] args) {
return ExitCode.INVALID_CONF;
}

if (conf.getBoolean("help", false)) {
printUsage();
return ExitCode.OK;
}

// 1. building the component stack:
LifecycleComponent server;
try {
Expand Down Expand Up @@ -244,6 +250,11 @@ private static ServerConfiguration parseCommandLine(String[] args)
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.",
Expand Down

0 comments on commit 9f202b0

Please sign in to comment.