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

disable workers without --force or with --dry

This commit is contained in:
deadc0de6
2020-11-17 11:25:03 +01:00
parent 5fb1024975
commit 89d6a1b6ed
2 changed files with 7 additions and 13 deletions

View File

@@ -264,11 +264,6 @@ def cmd_install(o):
dotfiles = o.dotfiles
prof = o.conf.get_profile()
# ensure parallel is unattended
if o.workers > 1 and o.safe:
LOG.err('\"-w --workers\" must be used with \"-f --force\"')
return False
pro_pre_actions = prof.get_pre_actions() if prof else []
pro_post_actions = prof.get_post_actions() if prof else []
@@ -360,7 +355,6 @@ def cmd_install(o):
def cmd_compare(o, tmp):
"""compare dotfiles and return True if all identical"""
# ensure parallel is unattended
dotfiles = o.dotfiles
if not dotfiles:
msg = 'no dotfile defined for this profile (\"{}\")'
@@ -382,7 +376,6 @@ def cmd_compare(o, tmp):
# in parallel
if o.debug:
LOG.dbg('run with {} workers'.format(o.workers))
ex = futures.ThreadPoolExecutor(max_workers=o.workers)
wait_for = []
for dotfile in selected:
@@ -412,11 +405,6 @@ def cmd_compare(o, tmp):
def cmd_update(o):
"""update the dotfile(s) from path(s) or key(s)"""
# ensure parallel is unattended
if o.workers > 1 and o.safe:
LOG.err('\"-w --workers\" must be used with \"-f --force\"')
return False
cnt = 0
paths = o.update_path
iskey = o.update_iskey
@@ -448,7 +436,6 @@ def cmd_update(o):
# in parallel
if o.debug:
LOG.dbg('run with {} workers'.format(o.workers))
ex = futures.ThreadPoolExecutor(max_workers=o.workers)
wait_for = []
for path in paths:

View File

@@ -227,6 +227,13 @@ class Options(AttrMonitor):
self.log.err('bad option for --workers')
sys.exit(USAGE)
if self.safe and self.workers > 1:
self.log.warn('workers set to 1 when --force is not used')
self.workers = 1
if self.dry and self.workers > 1:
self.log.warn('workers set to 1 when --dry is used')
self.workers = 1
# import link default value
self.import_link = self.link_on_import
if self.args['--link']: