-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Thor2, a class with more intuitive defaults #621
base: main
Are you sure you want to change the base?
Conversation
This new class allows having more expected defaults without breaking backward compatibility. Documentation can then recommend using Thor2 for new CLIs which will be more intuitive for users.
Alright, fixed the failures. Care to take a look @rafaelfranca? I think it would be great if this was in the next release. Also, if there are other defaults you think would make sense to be changed, now would be the time. |
Seems like more sensible defaults. How about |
I can see argument to change those defaults but I don't think it is worth the trouble to add a new base class that will just create confusing to people neither is worth a breaking release. Maybe a better path would ask people to explicitly set what the behavior they want in their commands sowing a deprecation in case the behavior is undefined and in a future breaking release we can flip the default since all existing code is explicit about which behavior they want. So for existent code either |
Thank you for the feedback @rafaelfranca, but I must disagree. (I hope the following doesn't sound harsh, there is a lot to say so I try to keep things short) Downsides of your suggestion:
Downside of my suggestion:
In both cases, users should specify a version requirement for their thor dependency. Either because of the new class being used, or because of the new class method used to avoid the deprecation warning. (Actually it will require that twice with your proposition, one for the class_method, and one after the breaking change) @marcandre An option, instead of |
I'm aware of the downside but I really don't want to maintain two base classes. Either we move everyone to the new defaults slowly or we keep the defaults as is. There is no explanation why this new class exists other than "We can't change the default so now we introduced two defaults". Thor is still in a pre 1.0 release so another option is change the default in thor 1.0 and have people deal with the breakage to upgrade to 1.0. |
I agree with @rafaelfranca and IMHO the best option would be to keep the current defaults for compatibility, and allow to override the defaults for those using either ENV vars (my preferred option) or a config file. Using the env vars approach would actually be a two line change:
|
For deprecation warnings, a good approach could be to issue those only for particular uses that break the new defaults. For example
Same idea for I think the @chroms idea to use the ENV variables would be better suited to suppress the deprecation warnings than to affect the behavior. This gives the power to the users of the packages affected to get on with their lives while the maintainers of the affected packages straighten things up. |
Example diff:
|
Realized in the 🚿 that I needed fixing my example diff to show we'd set the default to |
@marcandre's idea makes sense to me :)
…On Sep 21, 2018 8:39 PM, "Marc-André Lafortune" ***@***.***> wrote:
Realized in the 🚿 that I needed fixing my example diff to show we'd set
the default to nil and distinguish it from an explicit false 😅
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#621 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB0ffFudnsfaClxAVzR3oyP9MC2Jlxkeks5udTJhgaJpZM4WqdmJ>
.
|
👍 for that! |
…cit option given [rails#621]
I've created PRs for I'm not sure how difficult/doable the same treatment is possible for I'd like to make a proposal that might make it easier to switch the default for that particular setting for modern implementations, but it's a bit too late tonight for that. |
…cit option given [rails#621]
…cit option given [rails#621]
In order to make things more intuitive for new users without breaking backward compatibility, I propose adding a new base class for CLIs. I had no idea how to call that class, so I just went with
Thor2
, feel free to change it.Here are the more expected changed you get from inheriting from
Thor2
:Once this class is in the code, documentation could be changed to tell users to start from Thor2. From there on, some additional doc could be added to explain some of the options that have barely any documentation to customize either Thor or Thor2.
I think this is better than having the doc recommend to use X and Y options to everyone.