File tree 1 file changed +17
-6
lines changed
asyncapi-importer-cli/src/main/java/com/solace/ep/asyncapi/cli
1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,8 @@ public static void main(String[] args)
74
74
75
75
// Parse out options
76
76
try {
77
- if (checkForHelpOption (options , args )) {
77
+ if (checkForHelpOption (args )) {
78
+ displayHelp (options );
78
79
return ;
79
80
}
80
81
CommandLineParser cliParser = new DefaultParser ();
@@ -124,13 +125,23 @@ public static void main(String[] args)
124
125
}
125
126
}
126
127
127
- private static boolean checkForHelpOption ( final Options options , final String [] args ) throws ParseException
128
+ private static boolean checkForHelpOption ( String [] args )
128
129
{
130
+ Option helpOption = new Option ("h" , "help" , false , "Help Option" );
131
+ Options options = new Options ();
132
+ options .addOption (helpOption );
133
+
129
134
CommandLineParser cliParser = new DefaultParser ();
130
- CommandLine commandLine = cliParser .parse (options , args );
131
- boolean hasHelpOption = commandLine .hasOption ("h" );
132
- if (hasHelpOption ) {
133
- displayHelp (options );
135
+ boolean hasHelpOption = false ;
136
+
137
+ try {
138
+ CommandLine commandLine = cliParser .parse (options , args , false );
139
+ hasHelpOption = commandLine .hasOption ("h" );
140
+ // if (hasHelpOption) {
141
+ // displayHelp(options);
142
+ // }
143
+ } catch (ParseException parseException ) {
144
+ return false ;
134
145
}
135
146
return hasHelpOption ;
136
147
}
You can’t perform that action at this time.
0 commit comments