summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-11-15 16:06:23 +0100
committerAnton Khirnov <anton@khirnov.net>2020-11-15 16:06:23 +0100
commitd102d77393279a0ca1ce4aaf307e4151d54142ca (patch)
treef0fd17aa9d6403365cf09ff92bffdeaffa7ee470
parent5c0a76908b1eb77a06e4a9d95e377110f20dc05c (diff)
plugins/link: drop create options
It is an unnecessary complication. Just list the directories explicitly.
-rw-r--r--README.md2
-rw-r--r--dotbot/plugins/link.py22
2 files changed, 0 insertions, 24 deletions
diff --git a/README.md b/README.md
index ae7e570..cfb7e56 100644
--- a/README.md
+++ b/README.md
@@ -170,7 +170,6 @@ mapped to extended configuration dictionaries.
| Parameter | Explanation |
| --- | --- |
| `path` | The source for the symlink, the same as in the shortcut syntax (default: null, automatic (see below)) |
-| `create` | When true, create parent directories to the link as needed. (default: false) |
| `relink` | Removes the old target if it's a symlink (default: false) |
| `force` | Force removes the old target, file or folder, and forces a new link (default: false) |
| `relative` | Use a relative path to the source when creating the symlink (default: false, absolute links) |
@@ -184,7 +183,6 @@ mapped to extended configuration dictionaries.
```yaml
- link:
~/.config/terminator:
- create: true
path: config/terminator
~/.vim: vim
~/.vimrc:
diff --git a/dotbot/plugins/link.py b/dotbot/plugins/link.py
index 1064bb6..9130362 100644
--- a/dotbot/plugins/link.py
+++ b/dotbot/plugins/link.py
@@ -22,7 +22,6 @@ class Link(dotbot.Plugin):
canonical_path = defaults.get('canonicalize-path', True)
force = defaults.get('force', False)
relink = defaults.get('relink', False)
- create = defaults.get('create', False)
use_glob = defaults.get('glob', False)
test = defaults.get('if', None)
ignore_missing = defaults.get('ignore-missing', False)
@@ -33,7 +32,6 @@ class Link(dotbot.Plugin):
canonical_path = source.get('canonicalize-path', canonical_path)
force = source.get('force', force)
relink = source.get('relink', relink)
- create = source.get('create', create)
use_glob = source.get('glob', use_glob)
ignore_missing = source.get('ignore-missing', ignore_missing)
path = self._default_source(destination, source.get('path'))
@@ -60,8 +58,6 @@ class Link(dotbot.Plugin):
continue
elif glob_star_loc == -1 and len(glob_results) == 1:
# perform a normal link operation
- if create:
- success &= self._create(destination)
if force or relink:
success &= self._delete(path, destination, relative, canonical_path, force)
success &= self._link(path, destination, relative, canonical_path, ignore_missing)
@@ -71,14 +67,10 @@ class Link(dotbot.Plugin):
for glob_full_item in glob_results:
glob_item = glob_full_item[len(glob_base):]
glob_link_destination = os.path.join(destination, glob_item)
- if create:
- success &= self._create(glob_link_destination)
if force or relink:
success &= self._delete(glob_full_item, glob_link_destination, relative, canonical_path, force)
success &= self._link(glob_full_item, glob_link_destination, relative, canonical_path, ignore_missing)
else:
- if create:
- success &= self._create(destination)
if not ignore_missing and not self._exists(os.path.join(self._context.base_directory(), path)):
# we seemingly check this twice (here and in _link) because
# if the file doesn't exist and force is True, we don't
@@ -133,20 +125,6 @@ class Link(dotbot.Plugin):
path = os.path.expanduser(path)
return os.path.exists(path)
- def _create(self, path):
- success = True
- parent = os.path.abspath(os.path.join(os.path.expanduser(path), os.pardir))
- if not self._exists(parent):
- self._log.debug("Try to create parent: " + str(parent))
- try:
- os.makedirs(parent)
- except OSError:
- self._log.warning('Failed to create directory %s' % parent)
- success = False
- else:
- self._log.info('Creating directory %s' % parent)
- return success
-
def _delete(self, source, path, relative, canonical_path, force):
success = True
source = os.path.join(self._context.base_directory(canonical_path=canonical_path), source)