From 0739717a7f3899e49c2f4eb52deb2d8c843899cf Mon Sep 17 00:00:00 2001 From: Johannes Edmeier Date: Sun, 8 Nov 2015 23:15:55 +0100 Subject: [PATCH 1/2] 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 --- .../cli/command/options/OptionHandler.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java index 6911c94190..42cc049f02 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java @@ -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; @@ -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; } From 83f5928e8d52e0494739c923474aac18aedaeb4b Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 27 Jan 2016 18:05:23 +0100 Subject: [PATCH 2/2] Update copyright header --- .../springframework/boot/cli/command/options/OptionHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java index 42cc049f02..8da6a669b1 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.