The default option_name_mode changed from underscore to dash
#28
dskrypa
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As of version 2023.4.7, the default
option_name_modehas been updated from underscore to (_) to dash/hyphen (-).The motivation behind this change was to make the default be more in line with POSIX/GNU conventions.
While I recognize that this is a potentially breaking change for some CLIs, it is still early enough in the life of this project that the number of users who would potentially be impacted is very low. I apologize for any inconvenience this may cause.
This setting only affects the default long form for
Option,Flag, and similar parameters when an underscore exists in the name of the attribute that points to the parameter and no long form option string was explicitly defined. This setting does not affect parameters without any underscores in their attribute names.Option-like parameters in commands that already configured an explicit
option_name_mode, that already had a parameter-levelname_modeoverride, or that explicitly specified the desired long form option string will not be impacted.To restore the old behavior, the following options are available:
class MyCommand(Command, option_name_mode='_'):dry_run = Flag('-D', name_mode='_')dry_run = Flag('--dry_run', '-D')Beta Was this translation helpful? Give feedback.
All reactions