.. versionadded:: 2016.3.4

    Private function that returns the freebsd-update command string to be
    executed. It checks if any arguments are given to freebsd-update and appends
    them accordingly.

def _cmd(**kwargs):
    '''
    .. versionadded:: 2016.3.4

    Private function that returns the freebsd-update command string to be
    executed. It checks if any arguments are given to freebsd-update and appends
    them accordingly.
    '''
    update_cmd = salt.utils.path.which('freebsd-update')
    if not update_cmd:
        raise CommandNotFoundError('"freebsd-update" command not found')

    params = []
    if 'basedir' in kwargs:
        params.append('-b {0}'.format(kwargs['basedir']))
    if 'workdir' in kwargs:
        params.append('-d {0}'.format(kwargs['workdir']))
    if 'conffile' in kwargs:
        params.append('-f {0}'.format(kwargs['conffile']))
    if 'force' in kwargs:
        params.append('-F')
    if 'key' in kwargs:
        params.append('-k {0}'.format(kwargs['key']))
    if 'newrelease' in kwargs:
        params.append('-r {0}'.format(kwargs['newrelease']))
    if 'server' in kwargs:
        params.append('-s {0}'.format(kwargs['server']))
    if 'address' in kwargs:
        params.append('-t {0}'.format(kwargs['address']))

    if params:
        return '{0} {1}'.format(update_cmd, ' '.join(params))
    return update_cmd