mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-11-13 16:56:29 +00:00
Merge remote-tracking branch 'origin/master' into nightly
This commit is contained in:
commit
d58df5c70c
@ -0,0 +1 @@
|
||||
- [Bugfix] Correctly parse strings prefixed with pound "#" key in `tutor config save --set KEY=#value` commands. (by @regisb)
|
@ -41,6 +41,10 @@ class SerializeTests(unittest.TestCase):
|
||||
"x=key1:\n subkey: value\nkey2:\n subkey: value"
|
||||
),
|
||||
)
|
||||
self.assertEqual(
|
||||
("INDIGO_PRIMARY_COLOR", "#225522"),
|
||||
serialize.parse_key_value("INDIGO_PRIMARY_COLOR=#225522"),
|
||||
)
|
||||
|
||||
def test_str_format(self) -> None:
|
||||
self.assertEqual("true", serialize.str_format(True))
|
||||
|
@ -73,4 +73,8 @@ def parse_key_value(text: str) -> t.Optional[tuple[str, t.Any]]:
|
||||
if not value:
|
||||
# Empty strings are interpreted as null values, which is incorrect.
|
||||
value = "''"
|
||||
elif "\n" not in value and value.startswith("#"):
|
||||
# Single-line string that starts with a pound # key
|
||||
# We need to escape the string, otherwise pound will be interpreted as a comment.
|
||||
value = f'"{value}"'
|
||||
return key, parse(value)
|
||||
|
Loading…
Reference in New Issue
Block a user