Run config option validation even in raw mode

This commit is contained in:
Ivan Kravets committed 2021-10-26 15:41:41 +03:00
1 parent 1174958e8b
commit 8c8a94fc71
3 files changed
+10 -11

No files matched your search

+3 -3
View File
@@ -279,6 +279,9 @@ class ProjectConfigBase(object):
if value == MISSING:
return None
if option_meta.validate:
value = option_meta.validate(value)
return self._expand_interpolations(value)
def _expand_interpolations(self, value):
@@ -315,11 +318,8 @@ class ProjectConfigBase(object):
if not option_meta:
return value
if option_meta.validate:
value = option_meta.validate(value)
if option_meta.multiple:
value = self.parse_multi_values(value or [])
try:
return self.cast_to(value, option_meta.type)
except click.BadParameter as e:
+3
View File
@@ -107,6 +107,9 @@ def expand_dir_templates(path):
def validate_dir(path):
if not path:
return path
# if not all values expanded, ignore validation
if "${" in path and "}" in path:
return path
if path.startswith("~"):
path = fs.expanduser(path)
if "$" in path: