Пример #1
0
 def format_commands(
     self, ctx: click.core.Context, formatter: click.formatting.HelpFormatter
 ):
     for title, groups in self.groups:
         for group in groups:
             formatter.write(click.style(f"\n{title} from {group.name}", fg="green"))
             group.format_commands(ctx, formatter)
Пример #2
0
    def format_help_text(self, ctx: click.Context,
                         formatter: click.formatting.HelpFormatter):
        """
		Writes the help text to the formatter if it exists.

		:param ctx:
		:param formatter:
		"""

        formatter.write('\n')
        formatter.write(indent((self.help or ''), "  "))
        formatter.write('\n')
Пример #3
0
    def format_help_text(self, ctx: click.Context,
                         formatter: click.formatting.HelpFormatter):
        """
		Writes the help text to the formatter if it exists.

		:param ctx:
		:param formatter:
		"""

        doc = block_token.Document(self.help or '')

        with TerminalRenderer() as renderer:
            rendered_doc = indent(renderer.render(doc).strip(), "  ")

        if resolve_color_default(self._colour) is False:
            # Also remove 'COMBINING LONG STROKE OVERLAY', used for strikethrough.
            rendered_doc = strip_ansi(rendered_doc).replace('̶', '')

        formatter.write('\n')
        formatter.write(rendered_doc)
        formatter.write('\n')