From afd91226a87c9bec6af02cca2a6163457e56860f Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Sun, 10 Mar 2019 16:14:32 +0100 Subject: [PATCH] allow to update entire profile --- dotdrop/dotdrop.py | 16 ++++++++++++++++ dotdrop/updater.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dotdrop/dotdrop.py b/dotdrop/dotdrop.py index 9163af6..3a186c1 100644 --- a/dotdrop/dotdrop.py +++ b/dotdrop/dotdrop.py @@ -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) diff --git a/dotdrop/updater.py b/dotdrop/updater.py index 524fe15..96d6a87 100644 --- a/dotdrop/updater.py +++ b/dotdrop/updater.py @@ -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)