def cmd_update(opts, conf, paths, iskey=False): """update the dotfile(s) from path(s) or key(s)""" ret = True updater = Updater(conf, opts['dotpath'], opts['dry'], opts['safe'], iskey=iskey, debug=opts['debug']) if not iskey: # update paths if opts['debug']: LOG.dbg('update by paths: {}'.format(paths)) for path in paths: if not updater.update_path(path, opts['profile']): ret = False else: # update keys keys = paths if not keys: # if not provided, take all keys keys = [d.key for d in conf.get_dotfiles(opts['profile'])] if opts['debug']: LOG.dbg('update by keys: {}'.format(keys)) for key in keys: if not updater.update_key(key, opts['profile']): ret = False return ret
def cmd_update(o): """update the dotfile(s) from path(s) or key(s)""" ret = True paths = o.update_path iskey = o.update_iskey ignore = o.update_ignore showpatch = o.update_showpatch updater = Updater(o.dotpath, o.dotfiles, o.variables, dry=o.dry, safe=o.safe, debug=o.debug, ignore=ignore, showpatch=showpatch) if not iskey: # update paths if o.debug: LOG.dbg('update by paths: {}'.format(paths)) for path in paths: if not updater.update_path(path): ret = False else: # update keys keys = paths if not keys: # if not provided, take all keys keys = [d.key for d in o.dotfiles] if o.debug: LOG.dbg('update by keys: {}'.format(keys)) for key in keys: if not updater.update_key(key): ret = False return ret
def cmd_update(o): """update the dotfile(s) from path(s) or key(s)""" ret = True paths = o.update_path iskey = o.update_iskey ignore = o.update_ignore showpatch = o.update_showpatch if not paths: # update the entire profile if iskey: paths = [d.key for d in o.dotfiles] else: paths = [d.dst for d in o.dotfiles] msg = 'Update all dotfiles for profile \"{}\"'.format(o.profile) if o.safe and not LOG.ask(msg): return False if not paths: LOG.log('no dotfile to update') return True if o.debug: LOG.dbg('dotfile to update: {}'.format(paths)) updater = Updater(o.dotpath, o.variables, o.conf.get_dotfile, o.conf.get_dotfile_by_dst, o.conf.path_to_dotfile_dst, dry=o.dry, safe=o.safe, debug=o.debug, ignore=ignore, showpatch=showpatch) if not iskey: # update paths if o.debug: LOG.dbg('update by paths: {}'.format(paths)) for path in paths: if not updater.update_path(path): ret = False else: # update keys keys = paths if not keys: # if not provided, take all keys keys = [d.key for d in o.dotfiles] if o.debug: LOG.dbg('update by keys: {}'.format(keys)) for key in keys: if not updater.update_key(key): ret = False return ret
def _dotfile_update(o, path, key=False): """ update a dotfile pointed by path if key is false or by key (in path) """ updater = Updater(o.dotpath, o.variables, o.conf, dry=o.dry, safe=o.safe, debug=o.debug, ignore=o.update_ignore, showpatch=o.update_showpatch, ignore_missing_in_dotdrop=o.ignore_missing_in_dotdrop) if key: return updater.update_key(path) return updater.update_path(path)
def update(opts, conf, paths): """update the dotfile(s) from path(s)""" updater = Updater(conf, opts['dotpath'], opts['dry'], opts['safe'], opts['debug']) for path in paths: updater.update(path, opts['profile'])