def parse_remainder(args):
    """Parse the remainder of the command line arguments"""
    if len(args) == 0:
        return {}
    if not args[0].startswith(('-', '--')):
        raise ValueError('Only optional arguments allowed')
    kwargs = {}
    curr_arg = args[0]
    curr_val = None
    for arg in args[1:]:
        if arg.startswith(('-', '--')):
            if not curr_val:
                kwargs[curr_arg] = True
            else:
                kwargs[curr_arg] = curr_val
            curr_arg = arg
            curr_val = None
        elif not curr_val:
            cur_val = arg
        elif isinstance(cur_val, list):
            cur_val.append(arg)
        else:
            cur_val = [cur_val]
            cur_val.append(arg)
    return kwargs
