mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-16 23:09:11 +00:00
Forbid setting both link and link_children
This commit is contained in:
@@ -53,6 +53,7 @@ class Cfg:
|
|||||||
key_dotfiles_src = 'src'
|
key_dotfiles_src = 'src'
|
||||||
key_dotfiles_dst = 'dst'
|
key_dotfiles_dst = 'dst'
|
||||||
key_dotfiles_link = 'link'
|
key_dotfiles_link = 'link'
|
||||||
|
key_dotfiles_link_children = 'link_children'
|
||||||
key_dotfiles_noempty = 'ignoreempty'
|
key_dotfiles_noempty = 'ignoreempty'
|
||||||
key_dotfiles_cmpignore = 'cmpignore'
|
key_dotfiles_cmpignore = 'cmpignore'
|
||||||
key_dotfiles_actions = 'actions'
|
key_dotfiles_actions = 'actions'
|
||||||
@@ -217,11 +218,22 @@ class Cfg:
|
|||||||
for k, v in self.content[self.key_dotfiles].items():
|
for k, v in self.content[self.key_dotfiles].items():
|
||||||
src = os.path.normpath(v[self.key_dotfiles_src])
|
src = os.path.normpath(v[self.key_dotfiles_src])
|
||||||
dst = os.path.normpath(v[self.key_dotfiles_dst])
|
dst = os.path.normpath(v[self.key_dotfiles_dst])
|
||||||
link = LinkTypes.PARENTS \
|
|
||||||
if self.key_dotfiles_link in v and v[self.key_dotfiles_link] \
|
# Fail if both `link` and `link_children` present
|
||||||
else LinkTypes.CHILDREN \
|
if self.key_dotfiles_link in v \
|
||||||
if 'link_children' in v and v['link_children'] \
|
and self.key_dotfiles_link_children in v:
|
||||||
else LinkTypes.NOLINK
|
msg = 'only one of `link` or `link_children` allowed per'
|
||||||
|
msg += 'dotfile, error on dotfile "{}".'
|
||||||
|
self.log.err(msg.format(k))
|
||||||
|
|
||||||
|
# Otherwise, get link type
|
||||||
|
link = LinkTypes.NOLINK
|
||||||
|
if self.key_dotfiles_link in v and v[self.key_dotfiles_link]:
|
||||||
|
link = LinkTypes.PARENTS
|
||||||
|
if self.key_dotfiles_link_children in v \
|
||||||
|
and v[self.key_dotfiles_link_children]:
|
||||||
|
link = LinkTypes.CHILDREN
|
||||||
|
|
||||||
noempty = v[self.key_dotfiles_noempty] if \
|
noempty = v[self.key_dotfiles_noempty] if \
|
||||||
self.key_dotfiles_noempty \
|
self.key_dotfiles_noempty \
|
||||||
in v else self.lnk_settings[self.key_ignoreempty]
|
in v else self.lnk_settings[self.key_ignoreempty]
|
||||||
|
|||||||
Reference in New Issue
Block a user