| 164 | } |
| 165 | |
| 166 | export 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 | |
| 202 | let defaultPreferred: string | undefined |
| 203 | let defaultAcceptable: string | undefined |