cobra icon indicating copy to clipboard operation
cobra copied to clipboard

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

Open lakshithagunasekara opened this issue 4 years ago • 4 comments

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?

lakshithagunasekara avatar Feb 11 '21 05:02 lakshithagunasekara

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

github-actions[bot] avatar Apr 13 '21 00:04 github-actions[bot]

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

johnSchnake avatar Feb 16 '22 20:02 johnSchnake

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.

johnSchnake avatar Feb 16 '22 20:02 johnSchnake

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

slonka avatar May 31 '22 18:05 slonka

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

maxRN avatar Oct 02 '22 21:10 maxRN