Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/fixed-20260112-141104.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: fixed
body: Update the argument-parameter regex to allow optional whitespace after commas
time: 2026-01-12T14:11:04.576274188Z
custom:
Author: aviatco
AuthorLink: https://github.com/aviatco
7 changes: 1 addition & 6 deletions src/fabric_cli/utils/fab_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def remove_dot_suffix(path: str, dot_string_to_rm: str = ".Shortcut") -> str:
return path.replace(dot_string_to_rm, "").replace(dot_string_to_rm.lower(), "")



def get_dict_from_params(params: str | list[str], max_depth: int = 2) -> dict:
"""
Convert args to dict with a specified max nested level.
Expand All @@ -76,7 +75,7 @@ def get_dict_from_params(params: str | list[str], max_depth: int = 2) -> dict:
# Result ['key1.key2=hello', 'key2={"hello":"testing","bye":2}', 'key3=[1,2,3]', 'key4={"key5":"value5"}']
# Example key1.key2=hello
# Result ['key1.key=hello']
pattern = r"((?:[\w\.]+=.+?)(?=(?:,[\w\.]+=)|$))"
pattern = r"((?:[\w\.]+=.+?)(?=(?:,\s*[\w\.]+=)|$))"

if params:
if isinstance(params, list):
Expand Down Expand Up @@ -166,8 +165,6 @@ def remove_keys_from_dict(_dict: dict, keys: list) -> dict:
return _dict




def get_os_specific_command(command: str) -> str:
if platform.system() == "Windows":
return fab_constant.OS_COMMANDS.get(command, {}).get("windows", command)
Expand Down Expand Up @@ -237,5 +234,3 @@ def get_capacity_settings(
az_resource_group,
sku,
)


34 changes: 34 additions & 0 deletions tests/test_utils/test_fab_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,40 @@ def test_get_dict_from_params():
"desc3": "hi",
}

# Test space after comma - this tests the regex pattern fix that allows spaces after commas
params = "key1=value1, key2=value2, key3=value3"
result = utils.get_dict_from_params(params)
assert result == {"key1": "value1", "key2": "value2", "key3": "value3"}

# Test multiple spaces after comma
params = "key1=value1, key2=value2, key3=value3"
result = utils.get_dict_from_params(params)
assert result == {"key1": "value1", "key2": "value2", "key3": "value3"}

# Test mixed spacing (some with spaces, some without)
params = "key1=value1,key2=value2, key3=value3, key4=value4"
result = utils.get_dict_from_params(params)
assert result == {"key1": "value1", "key2": "value2", "key3": "value3", "key4": "value4"}

# Test with nested keys and spaces
params = "key1.sub1=value1, key1.sub2=value2, key2=value3"
result = utils.get_dict_from_params(params)
assert result == {"key1": {"sub1": "value1", "sub2": "value2"}, "key2": "value3"}

# Test with complex values and spaces
params = 'key1={"nested": "value"}, key2=[1,2,3], key3=simple'
result = utils.get_dict_from_params(params)
assert result == {
"key1": '{nested: value}',
"key2": "[1,2,3]",
"key3": "simple"
}

# Test tabs and mixed whitespace after comma
params = "key1=value1,\tkey2=value2,\n key3=value3"
result = utils.get_dict_from_params(params)
assert result == {"key1": "value1", "key2": "value2", "key3": "value3"}


def test_merge_dicts():
dict1 = {"key1": "value1", "key2": {"key1": "value2"}}
Expand Down