mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 23:34:00 +00:00
disable workers without --force or with --dry
This commit is contained in:
@@ -264,11 +264,6 @@ def cmd_install(o):
|
|||||||
dotfiles = o.dotfiles
|
dotfiles = o.dotfiles
|
||||||
prof = o.conf.get_profile()
|
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_pre_actions = prof.get_pre_actions() if prof else []
|
||||||
pro_post_actions = prof.get_post_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):
|
def cmd_compare(o, tmp):
|
||||||
"""compare dotfiles and return True if all identical"""
|
"""compare dotfiles and return True if all identical"""
|
||||||
# ensure parallel is unattended
|
|
||||||
dotfiles = o.dotfiles
|
dotfiles = o.dotfiles
|
||||||
if not dotfiles:
|
if not dotfiles:
|
||||||
msg = 'no dotfile defined for this profile (\"{}\")'
|
msg = 'no dotfile defined for this profile (\"{}\")'
|
||||||
@@ -382,7 +376,6 @@ def cmd_compare(o, tmp):
|
|||||||
# in parallel
|
# in parallel
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('run with {} workers'.format(o.workers))
|
LOG.dbg('run with {} workers'.format(o.workers))
|
||||||
|
|
||||||
ex = futures.ThreadPoolExecutor(max_workers=o.workers)
|
ex = futures.ThreadPoolExecutor(max_workers=o.workers)
|
||||||
wait_for = []
|
wait_for = []
|
||||||
for dotfile in selected:
|
for dotfile in selected:
|
||||||
@@ -412,11 +405,6 @@ def cmd_compare(o, tmp):
|
|||||||
|
|
||||||
def cmd_update(o):
|
def cmd_update(o):
|
||||||
"""update the dotfile(s) from path(s) or key(s)"""
|
"""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
|
cnt = 0
|
||||||
paths = o.update_path
|
paths = o.update_path
|
||||||
iskey = o.update_iskey
|
iskey = o.update_iskey
|
||||||
@@ -448,7 +436,6 @@ def cmd_update(o):
|
|||||||
# in parallel
|
# in parallel
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('run with {} workers'.format(o.workers))
|
LOG.dbg('run with {} workers'.format(o.workers))
|
||||||
|
|
||||||
ex = futures.ThreadPoolExecutor(max_workers=o.workers)
|
ex = futures.ThreadPoolExecutor(max_workers=o.workers)
|
||||||
wait_for = []
|
wait_for = []
|
||||||
for path in paths:
|
for path in paths:
|
||||||
|
|||||||
@@ -227,6 +227,13 @@ class Options(AttrMonitor):
|
|||||||
self.log.err('bad option for --workers')
|
self.log.err('bad option for --workers')
|
||||||
sys.exit(USAGE)
|
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
|
# import link default value
|
||||||
self.import_link = self.link_on_import
|
self.import_link = self.link_on_import
|
||||||
if self.args['--link']:
|
if self.args['--link']:
|
||||||
|
|||||||
Reference in New Issue
Block a user