from typing import List


def parse_cmd_output(output: str) -> List[str]:
    """Parse `cardano-cli` command output, return sub-commands and options names."""
    section_start = False
    cli_args = []
    for line in output.splitlines():
        if "Available " in line:
            section_start = True
            continue
        if section_start:
            # skip line with wrapped description from previous command
            if line.startswith("    "):
                continue
            # skip line with subsection description
            if not line.startswith(" "):
                continue
            line = line.strip()
            if not line:
                continue
            item = line.split(" ")[0]
            cli_args.append(item)

    return cli_args