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

fail early when profile does not exist (#300)

This commit is contained in:
deadc0de6
2021-01-29 21:45:32 +01:00
parent 636c1ade26
commit cccda6e284
2 changed files with 14 additions and 0 deletions

View File

@@ -419,6 +419,10 @@ def cmd_update(o):
paths = o.update_path paths = o.update_path
iskey = o.update_iskey iskey = o.update_iskey
if o.profile not in [p.key for p in o.profiles]:
LOG.err('no such profile \"{}\"'.format(o.profile))
return False
adapt_workers(o, LOG) adapt_workers(o, LOG)
if not paths: if not paths:

View File

@@ -95,6 +95,16 @@ class Updater:
dtpath = os.path.join(self.dotpath, dotfile.src) dtpath = os.path.join(self.dotpath, dotfile.src)
dtpath = os.path.expanduser(dtpath) dtpath = os.path.expanduser(dtpath)
if not os.path.exists(path):
msg = '\"{}\" does not exist'
self.log.err(msg.format(path))
return False
if not os.path.exists(dtpath):
msg = '\"{}\" does not exist, import it first'
self.log.err(msg.format(dtpath))
return False
if self._ignore([path, dtpath]): if self._ignore([path, dtpath]):
self.log.sub('\"{}\" ignored'.format(dotfile.key)) self.log.sub('\"{}\" ignored'.format(dotfile.key))
return True return True