1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-09 18:09:17 +00:00

allow to update entire profile

This commit is contained in:
deadc0de6
2019-03-10 16:14:32 +01:00
parent 25ac6fa84f
commit afd91226a8
2 changed files with 17 additions and 1 deletions

View File

@@ -173,6 +173,22 @@ def cmd_update(o):
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.dotfiles, o.variables,
dry=o.dry, safe=o.safe, debug=o.debug,
ignore=ignore, showpatch=showpatch)

View File

@@ -44,6 +44,7 @@ class Updater:
def update_path(self, path):
"""update the dotfile installed on path"""
path = os.path.expanduser(path)
if not os.path.lexists(path):
self.log.err('\"{}\" does not exist!'.format(path))
return False
@@ -51,7 +52,6 @@ class Updater:
dotfile = self._get_dotfile_by_path(path)
if not dotfile:
return False
path = os.path.expanduser(path)
if self.debug:
self.log.dbg('updating {} from path \"{}\"'.format(dotfile, path))
return self._update(path, dotfile)