Skip to content
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

Add support mutating args once added #458

Closed
kbknapp opened this issue Mar 23, 2016 · 2 comments
Closed

Add support mutating args once added #458

kbknapp opened this issue Mar 23, 2016 · 2 comments
Labels
C-enhancement Category: Raise on the bar on expectations E-hard Call for participation: Experience needed to fix: Hard / a lot
Milestone

Comments

@kbknapp
Copy link
Member

kbknapp commented Mar 23, 2016

It'd be nice to be able to mutate aspects of certain args after they've been add to an App struct.

What I'd like to be able to do is add a bunch of args via the App::args_from_usage then later go back and mutate the two or three outlyers that require some special setting, like possible_values or something.

@kbknapp kbknapp added C-enhancement Category: Raise on the bar on expectations C: args labels Mar 23, 2016
@joshtriplett
Copy link
Contributor

One possible interface to this would be a new App method mod_arg<F: FnMut(Arg) -> Arg>(name: &str, f: F):

let app = App::new("cmd").args_from_usage("...");
app.mod_arg("somearg", |arg| arg.possible_values(...));

@kbknapp kbknapp added E-hard Call for participation: Experience needed to fix: Hard / a lot and removed D: intermediate labels Nov 2, 2016
@kbknapp kbknapp added W: 3.x and removed W: 2.x labels Apr 5, 2017
@kbknapp kbknapp mentioned this issue Aug 22, 2017
87 tasks
@kbknapp kbknapp added this to the v3-alpha1 milestone Feb 2, 2018
@kbknapp
Copy link
Member Author

kbknapp commented Jul 22, 2018

Has been implemented on v3-master

@kbknapp kbknapp closed this as completed Jul 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Raise on the bar on expectations E-hard Call for participation: Experience needed to fix: Hard / a lot
Projects
None yet
Development

No branches or pull requests

2 participants