def deprecated_decorator(command): deprecated_suffix = " (deprecated)" help = command.help.splitlines()[0] if command.help else "" ref_short_help = make_default_short_help(help) if command.short_help == ref_short_help: command.short_help = make_default_short_help( command.help.splitlines()[0], max_length=90 - len(deprecated_suffix)) + deprecated_suffix command.deprecated = {"version": version, "message": message} return command
def __init__(self, *args, **kwargs): super(HelpMixin, self).__init__(*args, **kwargs) if self.help and 'short_help' not in kwargs.keys(): # just keep the first line of the help in the short help self.short_help = make_default_short_help( self.help.splitlines()[0], max_length=90) def show_help(ctx, param, value): if value and not ctx.resilient_parsing: click.echo(self.get_help_all(ctx), color=ctx.color) ctx.exit() self.params.append( AutomaticOption( ['--help-all'], is_flag=True, group=None, show_default=False, is_eager=True, expose_value=False, callback=show_help, help='Show the full help message, automatic options included.') )
def get_short_help_str(self, limit: int = 45) -> str: txt = self.alias.get("help") or self.alias["exec"] return make_default_short_help(txt)
def get_short_help_str(self, limit: int = 45) -> str: txt = self.alias.get("help") or "neuro " + self.alias["cmd"] return make_default_short_help(txt)
def get_short_help_str(self, limit: int = 45) -> str: if self.help is None: return "" head, *tail = self.help.split("\n", 1) return make_default_short_help(head.strip(" *_."))