Skip to content

feat: add deprecated option to commands#588

Open
mcncl wants to merge 3 commits intoalecthomas:masterfrom
mcncl:feat/deprecated_option
Open

feat: add deprecated option to commands#588
mcncl wants to merge 3 commits intoalecthomas:masterfrom
mcncl:feat/deprecated_option

Conversation

@mcncl
Copy link
Copy Markdown

@mcncl mcncl commented Mar 2, 2026

Description

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).

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 like tool <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

  • adds a new deprecated option to commands
    • adds to the required project files (kong.go, help.go and build.go)
    • adds testing

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;

- type providerWithoutErrorCLI struct {
- }

+ type providerWithoutErrorCLI struct{}

If it's preferred that these are restored to their former glory then I can totally do that.

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`)
@mcncl mcncl marked this pull request as ready for review March 2, 2026 01:56
@alecthomas
Copy link
Copy Markdown
Owner

Yes please revert the formatter changes.

@mcncl
Copy link
Copy Markdown
Author

mcncl commented Mar 2, 2026

@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 var has been opted for over :=

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 this pull request may close these issues.

2 participants