Skip to content
Myr

Add explanation for the casting

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kevin Deldycke · committed by Kevin Deldycke · parent bb2a1d9 · Browse files · 1 file+6 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Refs: https://github.com/pallets/click/pull/3030#discussion_r2289180249

Diff stats

1 file+6 added−0 removed

  • other:+6 added−0 removed

1 file+6 added−0 removed

modified:src/click/core.py+6 added
3057 unmodified lines
3058 # If we have no boolean default, we force the user to explicitly provide3059 # one.3060 if default in (UNSET, None):3061 default = None3062 # Nothing prevent you to declare an option that is auto-detected as a3063 # boolean flag, is allow to prompt but still declare a non-boolean default.3064 # So with this casting, we aligns the default value to the prompt behavior.3065 # The prompt is going to default to [Y/n]), and so not entering a value for3066 # input is expected to make the option takes True as the default.3067 # Refs: https://github.com/pallets/click/pull/3030#discussion_r22891802493068 else:3069 default = bool(default)3070 return confirm(self.prompt, default)3071
262 unmodified lines