def split_args(args):
    """Split command line args in 3 groups:
    - head, containing the initial options
    - body, containing everything after head, up to the first option
    - tail, containing everything after body
    """

    head = []
    body = []
    tail = []
    for arg in args:
        if arg.startswith("-"):
            if body:
                tail.append(arg)
            else:
                head.append(arg)
        else:
            if tail:
                tail.append(arg)
            else:
                body.append(arg)
    return head, body, tail