def print_commands(prefix: str, obj: CommandClient) -> None:
    """Print available commands for given object."""
    prefix += " -f "

    cmds = obj.call("commands")

    output = []
    for cmd in cmds:
        doc_args = get_formated_info(obj, cmd)

        pcmd = prefix + cmd
        output.append([pcmd, doc_args])

    max_cmd = max(len(pcmd) for pcmd, _ in output)

    # Print formatted output
    formatting = f"{{:<{(max_cmd + 1):d}}}\t{{}}"
    for line in output:
        print(formatting.format(line[0], line[1]))
Print available commands for given object.
libqtile/scripts/cmd_obj.py