MCPcopy Create free account
hub / github.com/FastLED/FastLED / strip_env_prefix

Function strip_env_prefix

ci/hooks/rust_tool_guard.py:85–101  ·  view source on GitHub ↗

Strip leading `VAR=value` env-var assignments. Return (rest, vars).

(command: str)

Source from the content-addressed store, hash-verified

83
84
85def strip_env_prefix(command: str) -> tuple[str, dict[str, str]]:
86 """Strip leading `VAR=value` env-var assignments. Return (rest, vars)."""
87 env_vars: dict[str, str] = {}
88 rest = command.lstrip()
89 while True:
90 m = _ENV_PREFIX_RE.match(rest)
91 if not m:
92 break
93 name = m.group(1)
94 value = m.group(2)
95 if value.startswith('"') and value.endswith('"'):
96 value = value[1:-1]
97 elif value.startswith("'") and value.endswith("'"):
98 value = value[1:-1]
99 env_vars[name] = value
100 rest = rest[m.end() :]
101 return rest, env_vars
102
103
104def _matches_rust_tool(command: str) -> str | None:

Callers 2

_matches_rust_toolFunction · 0.85
mainFunction · 0.85

Calls 1

endMethod · 0.45

Tested by

no test coverage detected