-
Notifications
You must be signed in to change notification settings - Fork 152
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
impl StructOpt for Box<impl StructOpt> #307
Conversation
The methods should just be declared, not implented with |
The trick here is - what if someone wants not derive but implement |
But if they implement it manually, they expect it to work with generated ones, and that's not the case. OTOH, adding new interface is a breaking change. I don't know... I'll think a bit about it, will comeback later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're OK with the drawbacks I've shown, I'm OK to merge this as is.
Yes, I'm fine with that. It's hard to imagine someone out there was trying to implement |
v0.3.6 published |
We implemented StructOpt on our own ^^ |
https://github.com/paritytech/substrate/blob/master/client/cli/src/params.rs#L957 for reference is someone is interested |
@bkchr OK, I have an idea on how to make this work without adding new methods to the |
Don't worry. I just wanted to comment here. I already have a patch for us to fix the problem. I also find it much better to have the method defined in the trait :) |
Okay, you already yanked it ^^ |
It was yanked for other reasons #315 |
Also, @bkchr , why don't you just derive it there? #[derive(Clone, Debug, Default, StructOpt)]
#[structopt(no_version)]
pub struct NoCustom {} As far as I can see, it would generate the same code (I mean, the code working the same way) as you have written manually. I hope you understand that impl AugmentClap for NoCustom {
fn augment_clap<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> {
app
}
} If you need to do something that's not covered by the public API, please, open an issue here and we will deal with that. |
Good question why I not used Basically we want to support adding extensions to the cli interface, that the users can define. |
[edit: deleted an created a separate issue] |
Closes #304
This PR makes
is_subcommand
,from_subcommand
, andaugment_clap
part of theStructOpt
trait (marking them asdoc(hidden)
. I believe this is justifiable change because:impl
s in future with ease.