public class DeprecatedObserver
{
public void beforeCommandExecution(@Observes PreCommandExecution cmd, Shell shell)
{
CommandMetadata command = cmd.getCommand();
boolean deprecated = command.getMethod().isAnnotationPresent(Deprecated.class);
if (deprecated)
{
String message = String.format("The command (%s) is deprecated and may be removed in future versions",
command.getName());
ShellMessages.warn(shell, message);
}
}