diff options
author | isXander <xandersmith2008@gmail.com> | 2023-06-17 09:14:17 +0100 |
---|---|---|
committer | isXander <xandersmith2008@gmail.com> | 2023-06-17 09:28:51 +0100 |
commit | d75d72f4e19ab57e745f21aac8e99d5246d04317 (patch) | |
tree | 7425972a80f359be8350912f3c8ad4191a4745c7 /common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java | |
parent | eb50b8f35d976b71f71c49b2e8108312aa7aa286 (diff) | |
download | YetAnotherConfigLib-d75d72f4e19ab57e745f21aac8e99d5246d04317.tar.gz YetAnotherConfigLib-d75d72f4e19ab57e745f21aac8e99d5246d04317.tar.bz2 YetAnotherConfigLib-d75d72f4e19ab57e745f21aac8e99d5246d04317.zip |
Reimplement custom ButtonOption text.
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java')
-rw-r--r-- | common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java b/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java index 9b3a613..01a6287 100644 --- a/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java +++ b/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java @@ -251,6 +251,10 @@ public final class OptionImpl<T> implements Option<T> { Validate.notNull(binding, "`binding` must not be null when building `Option`"); Validate.isTrue(!instant || flags.isEmpty(), "instant application does not support option flags"); + if (instant) { + listeners.add((opt, pendingValue) -> opt.applyValue()); + } + return new OptionImpl<>(name, descriptionFunction, controlGetter, binding, available, ImmutableSet.copyOf(flags), listeners); } } |