File tree Expand file tree Collapse file tree 1 file changed +3
-20
lines changed
app/src/main/java/com/diffplug/spotless/cli/steps Expand file tree Collapse file tree 1 file changed +3
-20
lines changed Original file line number Diff line number Diff line change 1515 */
1616package com .diffplug .spotless .cli .steps ;
1717
18- import java .util .Objects ;
18+ import java .util .Map ;
1919import java .util .function .Supplier ;
2020
2121import org .jetbrains .annotations .NotNull ;
@@ -34,26 +34,9 @@ public class CustomVersion {
3434 description = "The version of ${COMMAND-NAME} to use." + OptionConstants .DEFAULT_VALUE_SUFFIX )
3535 String useVersion ;
3636
37- abstract static class CustomVersionDefaultValueProvider implements CommandLine .IDefaultValueProvider {
38- private final Supplier <String > defaultVersionSupplier ;
39-
37+ abstract static class CustomVersionDefaultValueProvider extends OptionDefaultValueProvider {
4038 protected CustomVersionDefaultValueProvider (@ NotNull Supplier <String > defaultVersionSupplier ) {
41- this .defaultVersionSupplier = Objects .requireNonNull (defaultVersionSupplier );
42- }
43-
44- @ Override
45- public String defaultValue (CommandLine .Model .ArgSpec argSpec ) throws Exception {
46- // if it is the use-version option, provide the default version, otherwise null
47- if (!argSpec .isOption ()) {
48- return null ;
49- }
50- if (!(argSpec instanceof CommandLine .Model .OptionSpec optionSpec )) {
51- return null ;
52- }
53- if (!optionSpec .longestName ().equals (LONG_OPTION )) {
54- return null ;
55- }
56- return defaultVersionSupplier .get ();
39+ super (Map .of (LONG_OPTION , defaultVersionSupplier ));
5740 }
5841 }
5942}
You can’t perform that action at this time.
0 commit comments