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

Feature request: mark a flag as deprecated or retired #275

Closed
nevion opened this issue May 8, 2019 · 3 comments · Fixed by #358
Closed

Feature request: mark a flag as deprecated or retired #275

nevion opened this issue May 8, 2019 · 3 comments · Fixed by #358

Comments

@nevion
Copy link

nevion commented May 8, 2019

While maintaining a program that accepts CLI flags, one often wants to deprecate an option - still leaving it functional but providing a warning to the user, or retiring an option, meaning the flag is consumed but otherwise ignored.

Any thoughts on what that functionality could look inside CLI11?

@phlptp
Copy link
Collaborator

phlptp commented May 9, 2019

I can think of a couple approaches. One would be to add a deprecated flag, but that would add overhead on every option in terms of size and checking a flag. Probably not a lot but some.

The other options would be to add a wrapper function like deprecate_flag(app, flag_name) which goes through and modifies the description and injects a custom each function which prints out a deprecated message if the argument is used but otherwise does nothing.

A retired function could be similar but would probably need to replace the callback so it does nothing instead of the original callback.

Some advantages and disadvantages to both approaches. I could see it being a useful thing to have available though.

@jbriales
Copy link
Collaborator

jbriales commented Dec 2, 2019

This is a very interesting request :)
I'm wondering what would be the case for deprecating an option name rather than the whole option.
I.e. if the option gets multiple names like "--foo,--bar" and you want to deprecate one of the names only.

@phlptp
Copy link
Collaborator

phlptp commented Dec 3, 2019

I suppose I could see if you were wanting to shift the format conventions of a long form option to be consistent with other parts of a program, then you may only want to deprecate one of the names.

Though by far most of the use cases I might want this for would apply to the whole option. So in #358 I was only dealing with whole options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants