Пример #1
0
def generate_reference(cli: Group):
    with cli.make_context("tokfetch", ["tokfetch"], max_content_width=200, terminal_width=200) as ctx:
        main_help = cli.get_help(ctx)
        main_help = remove_ansi(main_help)
        main_help = textwrap.indent(main_help, "   ")
        print(TEMPLATE.format(main_help))

        for name in sorted(cli.commands.keys()):
            cmd = cli.commands[name]
            with cli.make_context("tokfetch {}".format(name), ["tokfetch", name]) as subcommand_ctx:
                short_help = cmd.help
                long_help = cmd.get_help(subcommand_ctx)
                long_help = textwrap.indent(long_help, "    ")
                print(SUBCOMMAND_TEMPLATE.format(name, name, short_help, long_help))
Пример #2
0
def get_help(self, ctx: Context):
    click_help = Group.get_help(self, ctx)
    return f"{VERSION_TEXT}\n" f"{DESCRIPTION}\n" f"\n" f"{click_help}"