Example #1
0
    def _describe_command(self, command: Command, **options: Any) -> None:
        command.merge_application_definition(False)

        description = command.description
        if description:
            self._write("<b>Description:</b>")
            self._write("\n")
            self._write("  " + description)
            self._write("\n\n")

        self._write("<b>Usage:</b>")
        for usage in [command.synopsis(True)
                      ] + command.aliases + command.usages:
            self._write("\n")
            self._write("  " + Formatter.escape(usage))

        self._write("\n")

        definition = command.definition
        if definition.options or definition.arguments:
            self._write("\n")
            self._describe_definition(definition, **options)
            self._write("\n")

        help_text = command.processed_help
        if help_text and help_text != description:
            self._write("\n")
            self._write("<b>Help:</b>")
            self._write("\n")
            self._write("  " + help_text.replace("\n", "\n  "))
            self._write("\n")