Remove a user from the minion

    CLI Example:

    .. code-block:: bash

        salt '*' user.delete name remove=True force=True

def delete(name, remove=False, force=False):
    '''
    Remove a user from the minion

    CLI Example:

    .. code-block:: bash

        salt '*' user.delete name remove=True force=True
    '''
    if salt.utils.stringutils.contains_whitespace(name):
        raise SaltInvocationError('Username cannot contain whitespace')
    if not info(name):
        return True

    # force is added for compatibility with user.absent state function
    if force:
        log.warning('force option is unsupported on MacOS, ignoring')

    # remove home directory from filesystem
    if remove:
        __salt__['file.remove'](info(name)['home'])

    # Remove from any groups other than primary group. Needs to be done since
    # group membership is managed separately from users and an entry for the
    # user will persist even after the user is removed.
    chgroups(name, ())
    return _dscl(['/Users/{0}'.format(name)], ctype='delete')['retcode'] == 0