Commit 0f9c7059 authored by Phillip Webb's avatar Phillip Webb

Rework OptionHandler '-cp' argument support

Change OptionHandler to support '-cp' instead of '--cp'. This update
to the original fix (045088e8) renders `help` output correctly and
should prevent potential issues if a `-p` command is added in the future.

Fixes gh-178
parent 3a82eac2
......@@ -84,6 +84,12 @@ public class OptionHandler {
}
public final void run(String... args) throws Exception {
String[] argsToUse = args.clone();
for (int i = 0; i < argsToUse.length; i++) {
if ("-cp".equals(argsToUse[i])) {
argsToUse[i] = "--cp";
}
}
OptionSet options = getParser().parse(args);
run(options);
}
......@@ -106,7 +112,7 @@ public class OptionHandler {
catch (IOException ex) {
return "Help not available";
}
this.help = out.toString();
this.help = out.toString().replace(" --cp ", " -cp ");
}
return this.help;
}
......@@ -169,6 +175,7 @@ public class OptionHandler {
this.options.add((option.length() == 1 ? "-" : "--") + option);
}
if (this.options.contains("--cp")) {
this.options.remove("--cp");
this.options.add("-cp");
}
this.description = descriptor.description();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment