1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 20:19:46 +00:00

fix splitting issue for #198 and rename to optional

This commit is contained in:
deadc0de6
2019-12-29 16:05:05 +01:00
parent 35ebd2b43a
commit 9e51dfc0e8
2 changed files with 12 additions and 8 deletions

View File

@@ -58,7 +58,7 @@ class CfgYaml:
key_import_variables = 'import_variables'
key_import_profile_dfs = 'import'
key_import_sep = ':'
key_import_ignore_key = 'ignore'
key_import_ignore_key = 'optional'
# settings
key_settings_dotpath = 'dotpath'
@@ -567,10 +567,11 @@ class CfgYaml:
"""normalize imported path and its attribute if any"""
fields = path.split(self.key_import_sep)
fatal_not_found = True
if len(fields) > 1:
if fields[1] == self.key_import_ignore_key:
fatal_not_found = False
return self._norm_path(fields[0]), fatal_not_found
filepath = path
if len(fields) > 1 and fields[-1] == self.key_import_ignore_key:
fatal_not_found = False
filepath = ''.join(fields[:-1])
return self._norm_path(filepath), fatal_not_found
def _import_actions(self):
"""import external actions from paths"""

View File

@@ -63,11 +63,14 @@ config:
create: true
dotpath: dotfiles
import_variables:
- /variables/does/not/exist:ignore
- /variables/does/not/exist:optional
- /variables/does/not/::exist:optional
import_actions:
- /actions/does/not/exist:ignore
- /actions/does/not/exist:optional
- /actions/does/not/::exist:optional
import_configs:
- /configs/does/not/exist:ignore
- /configs/does/not/exist:optional
- /configs/does/not/::exist:optional
dotfiles:
f_abc:
dst: ${tmpd}/abc