Skip to content

Mark commands as deprecated #1507

@raman325

Description

@raman325

This is more of a proposal than a request, so feel free to close this as won't implement, but it would be great to have a Command subclass/decorator to handle deprecated commands. The thought is that I could decorate my deprecated command and include a Callable parameter that represents the command that is replacing it. The value of having a decorator like this is that Click could standardize deprecation logic in help messaging and in command calls to state the deprecation notice and to provide the alternate command.

When searching for a solution to this problem, I came across this SO post which details how to subclass Option and Command for a similar use case: https://stackoverflow.com/questions/50366719/correct-way-to-deprecate-parameter-alias-in-click

I am happy to look into this approach if it is the preferred way to address such a problem, but wanted to mention it here first. Thanks for the consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions