MCPcopy Index your code
hub / github.com/anomalyco/opencode / args

Function args

packages/core/src/shell.ts:166–200  ·  view source on GitHub ↗
(file: string, command: string, cwd: string)

Source from the content-addressed store, hash-verified

164}
165
166export function args(file: string, command: string, cwd: string) {
167 const n = name(file)
168 if (n === "nu" || n === "fish") return ["-c", command]
169 if (n === "zsh") {
170 return [
171 "-l",
172 "-c",
173 `
174 [[ -f ~/.zshenv ]] && source ~/.zshenv >/dev/null 2>&1 || true
175 [[ -f "\${ZDOTDIR:-$HOME}/.zshrc" ]] && source "\${ZDOTDIR:-$HOME}/.zshrc" >/dev/null 2>&1 || true
176 cd -- "$1"
177 eval ${JSON.stringify(command)}
178 `,
179 "opencode",
180 cwd,
181 ]
182 }
183 if (n === "bash") {
184 return [
185 "-l",
186 "-c",
187 `
188 shopt -s expand_aliases
189 [[ -f ~/.bashrc ]] && source ~/.bashrc >/dev/null 2>&1 || true
190 cd -- "$1"
191 eval ${JSON.stringify(command)}
192 `,
193 "opencode",
194 cwd,
195 ]
196 }
197 if (n === "cmd") return ["/c", command]
198 if (ps(file)) return ["-NoProfile", "-Command", command]
199 return ["-c", command]
200}
201
202let defaultPreferred: string | undefined
203let defaultAcceptable: string | undefined

Callers

nothing calls this directly

Calls 2

psFunction · 0.85
nameFunction · 0.70

Tested by

no test coverage detected