import shlex


def parse_directive(directive):
    """Split a directive into a tuple consisting of a command and a
    list of arguments.  Raise `ValueError` if the directive is invalid.
    """
    try:
        args = shlex.split(directive)
    except ValueError:
        raise ValueError('unparsable directive: ' + directive)
    try:
        command = args.pop(0)
    except IndexError:
        raise ValueError('empty directive')
    return (command, args)