Accept true/false for --ssl_mode, keeping on/off#1606
Accept true/false for --ssl_mode, keeping on/off#1606rolandwalker wants to merge 1 commit intomainfrom
--ssl_mode, keeping on/off#1606Conversation
0039767 to
25dfa63
Compare
|
Findings
Open questions / assumptions
Test gaps
|
f7a399a to
82c54e4
Compare
|
Findings
Notes
Potential next steps
|
More liberally accept true/false/on/off (and capitalization variants) for --ssl_mode. Some inconsistencies in the interface have crept in as features were added. Some settings from ~/.myclirc especially, but also in the CLI arguments, use str_to_bool() for liberal boolean parsing. Other settings, such as --ssl_mode, are using on/off only. Other settings, such as --use_keyring, are using true/false only. This change is a step towards converging all boolean settings on liberal str_to_bool(). It should ultimately include DSN query parameters, too. The "auto" value for ssl_mode is still special-cased, and not affected by these changes. The only loss is that click doesn't automatically display the choices in the helpdoc, but they are already listed in the description. We keep the description targeted to on/off, and only silently accept the other variants.
82c54e4 to
a54f025
Compare
There was a problem hiding this comment.
Agree consistency is good, but --ssl_mode = true/false doesn't make sense from a naming perspective (it's not like --ssl = true/false, which makes more sense). A mode isn't true or false, it's on / off / auto. Converting that to true/false on the backend could make sense if desired for type checking, but I wouldn't expose it to the user.
Also the point of choice was to restrict it to those values, so isn't any issue with people putting in unexpected values.
Description
More liberally accept true/false/on/off (and capitalization variants) for
--ssl_mode.Some inconsistencies in the interface have crept in as features were added.
Some settings from
~/.myclircespecially, but also in the CLI arguments, usestr_to_bool()for liberal boolean parsing. Other settings, such as--ssl_mode, are using on/off only. Other settings, such as--use_keyring, are using true/false only.This change is a step towards converging all boolean settings on liberal
str_to_bool(). It should ultimately include DSN query parameters, too.The "auto" value for
ssl_modeis still special-cased, and not affected by these changes.The only loss is that click doesn't automatically display the choices in the helpdoc, but they are already listed in the description. We keep the description targeted to on/off, and only silently accept the other variants.
Checklist
changelog.mdfile.AUTHORSfile (or it's already there).