mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-16 17:20:16 +00:00
allow to update entire profile
This commit is contained in:
@@ -173,6 +173,22 @@ def cmd_update(o):
|
|||||||
ignore = o.update_ignore
|
ignore = o.update_ignore
|
||||||
showpatch = o.update_showpatch
|
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,
|
updater = Updater(o.dotpath, o.dotfiles, o.variables,
|
||||||
dry=o.dry, safe=o.safe, debug=o.debug,
|
dry=o.dry, safe=o.safe, debug=o.debug,
|
||||||
ignore=ignore, showpatch=showpatch)
|
ignore=ignore, showpatch=showpatch)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class Updater:
|
|||||||
|
|
||||||
def update_path(self, path):
|
def update_path(self, path):
|
||||||
"""update the dotfile installed on path"""
|
"""update the dotfile installed on path"""
|
||||||
|
path = os.path.expanduser(path)
|
||||||
if not os.path.lexists(path):
|
if not os.path.lexists(path):
|
||||||
self.log.err('\"{}\" does not exist!'.format(path))
|
self.log.err('\"{}\" does not exist!'.format(path))
|
||||||
return False
|
return False
|
||||||
@@ -51,7 +52,6 @@ class Updater:
|
|||||||
dotfile = self._get_dotfile_by_path(path)
|
dotfile = self._get_dotfile_by_path(path)
|
||||||
if not dotfile:
|
if not dotfile:
|
||||||
return False
|
return False
|
||||||
path = os.path.expanduser(path)
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
self.log.dbg('updating {} from path \"{}\"'.format(dotfile, path))
|
self.log.dbg('updating {} from path \"{}\"'.format(dotfile, path))
|
||||||
return self._update(path, dotfile)
|
return self._update(path, dotfile)
|
||||||
|
|||||||
Reference in New Issue
Block a user