@@ -109,12 +109,13 @@ private static ServerConfiguration parseArgs(String[] args)
109
109
BasicParser parser = new BasicParser ();
110
110
CommandLine cmdLine = parser .parse (BK_OPTS , args );
111
111
112
+ ServerConfiguration conf = new ServerConfiguration ();
113
+
112
114
if (cmdLine .hasOption ('h' )) {
113
- throw new IllegalArgumentException ();
115
+ conf .setProperty ("help" , true );
116
+ return conf ;
114
117
}
115
118
116
- ServerConfiguration conf = new ServerConfiguration ();
117
-
118
119
if (cmdLine .hasOption ('c' )) {
119
120
String confFile = cmdLine .getOptionValue ("c" );
120
121
loadConfFile (conf , confFile );
@@ -210,6 +211,11 @@ static int doMain(String[] args) {
210
211
return ExitCode .INVALID_CONF ;
211
212
}
212
213
214
+ if (conf .getBoolean ("help" , false )) {
215
+ printUsage ();
216
+ return ExitCode .OK ;
217
+ }
218
+
213
219
// 1. building the component stack:
214
220
LifecycleComponent server ;
215
221
try {
@@ -244,6 +250,11 @@ private static ServerConfiguration parseCommandLine(String[] args)
244
250
printUsage ();
245
251
throw iae ;
246
252
}
253
+
254
+ if (conf .getBoolean ("help" , false )) {
255
+ return conf ;
256
+ }
257
+
247
258
String hello = String .format (
248
259
"Hello, I'm your bookie, bookieId is %1$s, listening on port %2$s. Metadata service uri is %3$s."
249
260
+ " Journals are in %4$s. Ledgers are stored in %5$s. Indexes are stored in %6$s." ,
0 commit comments