mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 07:17:17 +00:00
fix: allow colon in options interpolation
This commit is contained in:
parent
df2e98a1d3
commit
9e30e98e90
@ -52,7 +52,7 @@ class ShellInterpolator(configparser.Interpolation):
|
||||
def identifiers() -> Generator[tuple[str | None, str], None, None]:
|
||||
# extract all found identifiers and parse them
|
||||
for identifier in ShellTemplate(value).get_identifiers():
|
||||
match identifier.split(":"):
|
||||
match identifier.rsplit(":", maxsplit=1):
|
||||
case [lookup_option]: # single option from the same section
|
||||
yield None, lookup_option
|
||||
case [lookup_section, lookup_option]: # reference to another section
|
||||
|
@ -24,6 +24,9 @@ def _parser() -> dict[str, dict[str, str]]:
|
||||
"key3": "${section1:home}",
|
||||
"key5": "${section1:key4}",
|
||||
},
|
||||
"section4:suffix": {
|
||||
"key6": "value6"
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +48,10 @@ def test_extract_variables() -> None:
|
||||
|
||||
assert not dict(ShellInterpolator._extract_variables(parser, "${section4:key1}", parser["section1"]))
|
||||
|
||||
assert dict(ShellInterpolator._extract_variables(parser, "${section4:suffix:key6}", parser["section1"])) == {
|
||||
"section4:suffix:key6": "value6",
|
||||
}
|
||||
|
||||
|
||||
def test_environment() -> None:
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user