MCPcopy Create free account
hub / github.com/anomalyco/opencode / expand

Function expand

packages/opencode/src/tool/shell.ts:154–160  ·  view source on GitHub ↗
(text: string, cwd: string, shell: string)

Source from the content-addressed store, hash-verified

152}
153
154function expand(text: string, cwd: string, shell: string) {
155 const out = unquote(text)
156 .replace(/\$\{env:([^}]+)\}/gi, (_, key: string) => envValue(key) || "")
157 .replace(/\$env:([A-Za-z_][A-Za-z0-9_]*)/gi, (_, key: string) => envValue(key) || "")
158 .replace(/\$(HOME|PWD|PSHOME)(?=$|[\\/])/gi, (_, key: string) => auto(key, cwd, shell) || "")
159 return home(out)
160}
161
162function provider(text: string) {
163 const match = text.match(/^([A-Za-z]+)::(.*)$/)

Callers 1

shell.tsFile · 0.70

Calls 4

unquoteFunction · 0.70
envValueFunction · 0.70
autoFunction · 0.70
homeFunction · 0.70

Tested by

no test coverage detected