Replies: 2 comments
-
However, if you really want to do that, you can use transformAll instead:
|
Beta Was this translation helpful? Give feedback.
-
In my case, it would require additional Bash scripts with logic to determine whether to add an option based on the provided value. Since we aim to migrate all logic to Kotlin, this approach doesn't work for us. ( Mean showing error to user ). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
I'm trying to create a custom converter for
BuildType?
, which I can implement successfully. However, I run into an issue when trying to use it with:The problem is that
option().converter()
expects a non-nullable type, making it incompatible with my implementation.Implementation
Here’s my current converter:
Real-World Use Case
In our CI pipeline, parameters are configured via a UI interface, and the
build_type
parameter may or may not be provided. The CLI command is executed as follows:./cli command --build-type %build_type%
If
build_type
is not set, it remains empty, causing the command to fail. To handle this scenario, I need a custom converter that gracefully handles an empty value by returningnull
.Question
Is there a recommended approach or workaround to make
option().converter()
work with nullableBuildType?
, allowing it to accept empty values without causing an error?Any insights or suggestions would be greatly appreciated! 🚀
Beta Was this translation helpful? Give feedback.
All reactions