feat: add deprecated option to commands#588
Open
mcncl wants to merge 3 commits intoalecthomas:masterfrom
Open
Conversation
This adds an option to commands for use of `deprecated:""`. It follows the same patterns as other options, like `hidden:""` but accepts a message in the quotes to override the default (`command "old-cmd" is deprecated`)
Owner
|
Yes please revert the formatter changes. |
Author
|
@alecthomas done. I've reverted the formatting changes to both untouched files and files that I did amend that had existing choices for how things like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds an option to commands for use of
deprecated:"". It follows the same patterns as other options, likehidden:""but accepts a message in the quotes to override the default (command "old-cmd" is deprecated).Context
I've been using
hidden:""where I don't want users to find a command, however I also do want to steer them to the correct path if it just happens to be a command that they've memorised. I find it adds for a safer removal of deprecated commands, rather than having to constantly factor in backwards compat. For example, I've opted to add a better structure to my commands, such as;tool <thing> <action>, but still have things liketool <action>available which go against this pattern. I want folks to be able to see that it's deprecated and will be removed in the future.Changes
deprecatedoption to commandskong.go,help.goandbuild.go)Notes
I did run
gofumpt -l -w .before submitting this PR, as that's my formatter of choice, which has made some other changes due to its own rules, such as;If it's preferred that these are restored to their former glory then I can totally do that.