1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 21:29:43 +00:00

do not execute action when --dry

This commit is contained in:
deadc0de6
2018-06-08 22:44:42 +02:00
parent 952230ef47
commit 0328efedee

View File

@@ -91,8 +91,11 @@ def install(opts, conf):
for dotfile in dotfiles:
if dotfile.actions and Cfg.key_actions_pre in dotfile.actions:
for action in dotfile.actions[Cfg.key_actions_pre]:
LOG.dbg('executing pre action {}'.format(action))
action.execute()
if opts['dry']:
LOG.dry('would execute action: {}'.format(action))
else:
LOG.dbg('executing pre action {}'.format(action))
action.execute()
LOG.dbg('installing {}'.format(dotfile))
if hasattr(dotfile, 'link') and dotfile.link:
r = inst.link(dotfile.src, dotfile.dst)
@@ -126,8 +129,11 @@ def install(opts, conf):
actions = dotfile.actions[Cfg.key_actions_post]
# execute action
for action in actions:
LOG.dbg('executing post action {}'.format(action))
action.execute()
if opts['dry']:
LOG.dry('would execute action: {}'.format(action))
else:
LOG.dbg('executing post action {}'.format(action))
action.execute()
installed.extend(r)
LOG.log('\n{} dotfile(s) installed.'.format(len(installed)))
return True