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: deprecate an option/command #1518
Comments
@laggingreflex this is a neat idea 👍 |
Cool. I'll try to implement myself this when I get some time. Any preferences for the following:
Anything else? PS: Hadn't yet thought about the "command" yet.. will think and comment later. |
@laggingreflex Thanks for digging into this.
A boolean would be easier to implement, but a string would be more practical (nowing how not to use a deprecated option is good, and IMHO the first reason for having such a deprecation notice). Perhaps you should have a look at existing keys, to try to mimic as much as possible the behavior and naming of an existing key, for homogeneity (I do not have the time right now to do it myself)? Concerning text placement, I would suggest looking first as how "reference" CLI (GNU tools, git, docker, npm, etc.) do it (if they do it), not to reinvent the wheel. I would also suggest keeping type and default, as a deprecated option is still valid and usable. And if we add this, I would definitely want it also for commands! |
Was able to finally get this into motion. Please checkout #1559 It implements deprecating just the option for now. Will try to work on command later. Also, I couldn't find much references in common tools (git, docker, npm) that do it. If you come across it please let me know. I did find a deprecated option in Docker, but, and I'm not entirely sure, but it didn't seem to mention that option in its --help usage at all. The deprecated option was missing. However running the command using the deprecated option showed a warning message: "this option has been deprecated". Is that something that should be implemented? I.e. show a warning message when one of the deprecated option is provided in the command-line? (in addition to what I've already done above?) |
Shows a [deprecated] notice in front of a command * Added a 5th argument in `.command(..., deprecated: boolean|string)` * Added a key in : `.command({...builder, deprecated: boolean|string})` * Fix, add tests * Readme Work towards yargs#1518
Shows a [deprecated] notice in front of a command * Added a 5th argument in `.command(..., deprecated: boolean|string)` * Added a key in : `.command({...module, deprecated: boolean|string})` * Fix, add tests * Readme Work towards yargs#1518
Looks like this landed in #1624, thanks @laggingreflex. This issue has not had any activity in over six months. Feel free to open a new issue if it comes up again, with new information and renewed interest. Thank you for your contributions. |
Allow setting
deprecated: true
for an option or a command, like:which will show up in help as:
The text was updated successfully, but these errors were encountered: