from typing import List
import shlex
import difflib


def diff_commands(cmd1: str, cmd2: str) -> str:
    """Return a unified diff of two shell commands."""
    def diffable(cmd: str) -> List[str]:
        args = shlex.split(cmd)
        pretty = []
        i = 0
        while i < len(args):
            if args[i] in ("-o", "-iquote", "-isystem", "-MF"):
                pretty.append(args[i] + " " + args[i + 1])
                i += 2
            else:
                pretty.append(args[i])
                i += 1
        return pretty
    args1 = diffable(cmd1)
    args2 = diffable(cmd2)
    return "\n".join(tuple(difflib.unified_diff(args1, args2, n=999))[2:])