def METHOD_NAME(parent_ctx, command, stack) -> CommandInfo:
    """
    Walk given command and all subcommands and create corresponding CommandInfo
    """
    with click.Context(
        command,
        info_name=stack[-1],
        color=False,
        terminal_width=80,
        max_content_width=80,
        parent=parent_ctx,
    ) as ctx:
        info = parse_doc(ctx, command, stack)
        if info.is_group:
            for command_name in command.list_commands(ctx):
                sub_cmd = command.get_command(ctx, command_name)
                if sub_cmd is None:
                    continue
                if sub_cmd.hidden:
                    continue
                info.children.append(
                    METHOD_NAME(ctx, sub_cmd, stack + [command_name])
                )
    return info