def _check(delete, force, update, passwordfile, exclude, excludefrom, dryrun, rsh):
    '''
    Generate rsync options
    '''
    options = ['-avz']

    if delete:
        options.append('--delete')
    if force:
        options.append('--force')
    if update:
        options.append('--update')
    if rsh:
        options.append('--rsh={0}'.format(rsh))
    if passwordfile:
        options.extend(['--password-file', passwordfile])
    if excludefrom:
        options.extend(['--exclude-from', excludefrom])
        if exclude:
            exclude = False
    if exclude:
        if isinstance(exclude, list):
            for ex_ in exclude:
                options.extend(['--exclude', ex_])
        else:
            options.extend(['--exclude', exclude])
    if dryrun:
        options.append('--dry-run')
    return options
def _check ( delete , force , update , passwordfile , exclude , excludefrom , dryrun , rsh ) : options = [ '-avz' ] if delete : options . append ( '--delete' ) if force : options . append ( '--force' ) if update : options . append ( '--update' ) if rsh : options . append ( '--rsh={0}' . format ( rsh ) ) if passwordfile : options . extend ( [ '--password-file' , passwordfile ] ) if excludefrom : options . extend ( [ '--exclude-from' , excludefrom ] ) if exclude : exclude = False if exclude : if isinstance ( exclude , list ) : for ex_ in exclude : options . extend ( [ '--exclude' , ex_ ] ) else : options . extend ( [ '--exclude' , exclude ] ) if dryrun : options . append ( '--dry-run' ) return options
Generate rsync options