Issue with `Options.boolean` and `Options.withDefault` in Effect cli
Hi there!
I've found a counter-intuitive behavior when mixing
I kind of understand that this was probably built with the intent of using it like: if
I think the worst part of this is that you can set the default to true without knowing that it won't be taken into account which can lead to bugs.
It would be great to either:
- have the
- have a typescript error when using
Let me know if you need more details and if can help implement the fix you think it best.
I've found a counter-intuitive behavior when mixing
Options.boolean with Options.withDefault Basically Options.boolean set a default to !isPresent which is false by default and trying to set a default to true (Options.withDefault(Options.boolean('foo'), true)) does not work. The default set by Options.boolean is the one used.I kind of understand that this was probably built with the intent of using it like: if
--foo is present, it's true, if it's not present, it's false but we can also set it with --foo false to set it to false.I think the worst part of this is that you can set the default to true without knowing that it won't be taken into account which can lead to bugs.
It would be great to either:
- have the
Options.withDefault work with Options.boolean, meaning that Options.withDefault(Options.boolean('foo'), true) would set foo to true if omitted- have a typescript error when using
Options.withDefault on Options.boolean, in order to be warned at compile time that it won't workLet me know if you need more details and if can help implement the fix you think it best.
