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

Is there a way to customise entire deprecate message for a command #1343

Open
lakshithagunasekara opened this issue Feb 11, 2021 · 5 comments
Labels
area/lib Methods and functions that exist in the cobra library and consumed by users kind/feature A feature request for cobra; new or enhanced behavior

Comments

@lakshithagunasekara
Copy link

If we are using two commands together in a cli, eg: apictl list apis -e dev (listCmd added to RootCmd and listAPIsCmd added to listCmd). we are deprecating the middle command list and replace it with get eg: apictl get apis -e dev.

First I marked the list as the Deprecated command. However this doesn't print the deprecate message when we used apictl list apis. It will print deprecate only if we used apictl list.

When we added the deprecate message to both listCmd and listApisCmd, then the message for listApisCmd is print as follows.
Command "apis" is deprecated, <message>. First part of the message default prints the last command in the chain and my requirement is not deprecating the last command, but the previous command.

Is there a way to achieve this or customise the entire deprecate message?

@github-actions
Copy link

This issue is being marked as stale due to a long period of inactivity

@johnSchnake
Copy link
Collaborator

This seems like a reasonable problem to discuss fixing; tagging the issue and removing stale.

@johnSchnake johnSchnake added area/lib Methods and functions that exist in the cobra library and consumed by users kind/feature A feature request for cobra; new or enhanced behavior and removed kind/stale labels Feb 16, 2022
@johnSchnake
Copy link
Collaborator

It seems like the deprecation could be marked as being persistent, so that farther down the callstack you continue to get the same message.

I'm definitely open to reviewing a PR for that; it seems like a pretty common case someone might get backed into.

@slonka
Copy link

slonka commented May 31, 2022

I would also be interested in customising the deprecation message (needed here - kumahq/kuma#4380). Is it ok to open a PR on this @johnSchnake?

@maxRN
Copy link

maxRN commented Oct 2, 2022

Hi, I'm interested at taking shot at this. Do you mind if I open a PR? @johnSchnake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lib Methods and functions that exist in the cobra library and consumed by users kind/feature A feature request for cobra; new or enhanced behavior
Projects
None yet
Development

No branches or pull requests

4 participants