Rename 'canonicalize-path' into 'canonicalize'
This parallels 'relative' (it's not 'relative-path'). The old 'canonicalize-path' is still supported for backward compatibility.
This commit is contained in:
parent
66489f7955
commit
f15293b3d5
3 changed files with 22 additions and 4 deletions
|
@ -177,7 +177,7 @@ mapped to extended configuration dictionaries.
|
|||
| `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) |
|
||||
| `canonicalize-path` | Resolve any symbolic links encountered in the source to symlink to the canonical path (default: true, real paths) |
|
||||
| `canonicalize` | Resolve any symbolic links encountered in the source to symlink to the canonical path (default: true, real paths) |
|
||||
| `glob` | Treat a `*` character as a wildcard, and perform link operations on all of those matches (default: false) |
|
||||
| `if` | Execute this in your `$SHELL` and only link if it is successful. |
|
||||
| `ignore-missing` | Do not fail if the source is missing and create the link anyway (default: false) |
|
||||
|
|
|
@ -27,7 +27,8 @@ class Link(dotbot.Plugin):
|
|||
for destination, source in links.items():
|
||||
destination = os.path.expandvars(destination)
|
||||
relative = defaults.get('relative', False)
|
||||
canonical_path = defaults.get('canonicalize-path', True)
|
||||
# support old "canonicalize-path" key for compatibility
|
||||
canonical_path = defaults.get('canonicalize', defaults.get('canonicalize-path', True))
|
||||
force = defaults.get('force', False)
|
||||
relink = defaults.get('relink', False)
|
||||
create = defaults.get('create', False)
|
||||
|
@ -39,7 +40,7 @@ class Link(dotbot.Plugin):
|
|||
# extended config
|
||||
test = source.get('if', test)
|
||||
relative = source.get('relative', relative)
|
||||
canonical_path = source.get('canonicalize-path', canonical_path)
|
||||
canonical_path = source.get('canonicalize', source.get('canonicalize-path', canonical_path))
|
||||
force = source.get('force', force)
|
||||
relink = source.get('relink', relink)
|
||||
create = source.get('create', create)
|
||||
|
|
|
@ -3,6 +3,7 @@ test_description='linking path canonicalization can be disabled'
|
|||
|
||||
test_expect_success 'setup' '
|
||||
echo "apple" > ${DOTFILES}/f &&
|
||||
echo "grape" > ${DOTFILES}/g &&
|
||||
ln -s dotfiles dotfiles-symlink
|
||||
'
|
||||
|
||||
|
@ -21,3 +22,19 @@ ${DOTBOT_EXEC} -c ./dotfiles-symlink/${INSTALL_CONF}
|
|||
test_expect_success 'test' '
|
||||
[ "$(readlink ~/.f | cut -d/ -f5-)" = "dotfiles-symlink/f" ]
|
||||
'
|
||||
|
||||
test_expect_success 'run 2' '
|
||||
cat > "${DOTFILES}/${INSTALL_CONF}" <<EOF
|
||||
- defaults:
|
||||
link:
|
||||
canonicalize: false
|
||||
- link:
|
||||
~/.g:
|
||||
path: g
|
||||
EOF
|
||||
${DOTBOT_EXEC} -c ./dotfiles-symlink/${INSTALL_CONF}
|
||||
'
|
||||
|
||||
test_expect_success 'test' '
|
||||
[ "$(readlink ~/.g | cut -d/ -f5-)" = "dotfiles-symlink/g" ]
|
||||
'
|
||||
|
|
Loading…
Reference in a new issue