let proceed = Input.readBool(prompt: "Proceed? [Y/n]: ", defaultValue: true)
It falls back to defaultValue only for empty input. Invalid input is treated the same as it is already (i.e., it's refused until corrected, which matches the behavior of most CLIs).
Existing behavior is the same (no breaking changes).
This allows writing the following:
It falls back to
defaultValue
only for empty input. Invalid input is treated the same as it is already (i.e., it's refused until corrected, which matches the behavior of most CLIs).Existing behavior is the same (no breaking changes).