Remove closure-execution from OptionHandler
It seems that the code for executing a groovy closure from the OptionHandler is never executed and therefore not needed. Removing the code gives the benefit that the Groovy-classes are not needed if someone else wants to use the spring-boot-cli infrastructure to run his own cli interface. Closes gh-4411
This commit is contained in:
parent
e7c7556266
commit
0739717a7f
|
@ -29,7 +29,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import groovy.lang.Closure;
|
||||
import joptsimple.BuiltinHelpFormatter;
|
||||
import joptsimple.HelpFormatter;
|
||||
import joptsimple.OptionDescriptor;
|
||||
|
@ -51,8 +50,6 @@ public class OptionHandler {
|
|||
|
||||
private OptionParser parser;
|
||||
|
||||
private Closure<?> closure;
|
||||
|
||||
private String help;
|
||||
|
||||
private Collection<OptionHelp> optionHelp;
|
||||
|
@ -76,10 +73,6 @@ public class OptionHandler {
|
|||
protected void options() {
|
||||
}
|
||||
|
||||
public void setClosure(Closure<?> closure) {
|
||||
this.closure = closure;
|
||||
}
|
||||
|
||||
public final ExitStatus run(String... args) throws Exception {
|
||||
String[] argsToUse = args.clone();
|
||||
for (int i = 0; i < argsToUse.length; i++) {
|
||||
|
@ -98,18 +91,6 @@ public class OptionHandler {
|
|||
* @throws Exception in case of errors
|
||||
*/
|
||||
protected ExitStatus run(OptionSet options) throws Exception {
|
||||
if (this.closure != null) {
|
||||
Object result = this.closure.call(options);
|
||||
if (result instanceof ExitStatus) {
|
||||
return (ExitStatus) result;
|
||||
}
|
||||
if (result instanceof Boolean) {
|
||||
return (Boolean) result ? ExitStatus.OK : ExitStatus.ERROR;
|
||||
}
|
||||
if (result instanceof Integer) {
|
||||
return new ExitStatus((Integer) result, "Finished");
|
||||
}
|
||||
}
|
||||
return ExitStatus.OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue