summaryrefslogtreecommitdiff
path: root/dotbot
diff options
context:
space:
mode:
authorBao Trinh <github@baodtrinh.com>2018-11-17 15:00:18 -0600
committerBao Trinh <github@baodtrinh.com>2018-11-17 15:00:18 -0600
commit7add8662157438b9a18b1eead0357b7857049085 (patch)
tree4c1bb327bf26e741e454ff5c3682ad1f69911bfb /dotbot
parente35b0794fde7d2f0957626cafe6e08709c0fc56b (diff)
Support defining default conditional option for links
Diffstat (limited to 'dotbot')
-rw-r--r--dotbot/plugins/link.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/dotbot/plugins/link.py b/dotbot/plugins/link.py
index bf1c5a9..2506237 100644
--- a/dotbot/plugins/link.py
+++ b/dotbot/plugins/link.py
@@ -30,12 +30,10 @@ class Link(dotbot.Plugin):
relink = defaults.get('relink', False)
create = defaults.get('create', False)
use_glob = defaults.get('glob', False)
+ test = defaults.get('if', None)
if isinstance(source, dict):
# extended config
- test = source.get('if')
- if test is not None and not self._test_success(test):
- self._log.lowinfo('Skipping %s' % destination)
- continue
+ test = source.get('if', test)
relative = source.get('relative', relative)
force = source.get('force', force)
relink = source.get('relink', relink)
@@ -44,6 +42,9 @@ class Link(dotbot.Plugin):
path = self._default_source(destination, source.get('path'))
else:
path = self._default_source(destination, source)
+ if test is not None and not self._test_success(test):
+ self._log.lowinfo('Skipping %s' % destination)
+ continue
path = os.path.expandvars(os.path.expanduser(path))
if use_glob:
self._log.debug("Globbing with path: " + str(path))