* Build a shell command from a base + already-trusted prefix and an array * of user-supplied args. Each arg is escaped via escapeShellArg. * * Example: buildCommand('rg', ['--files', '--glob'], userPattern)
(base, trusted, ...userArgs)
| 194 | * Example: buildCommand('rg', ['--files', '--glob'], userPattern) |
| 195 | */ |
| 196 | function buildCommand(base, trusted, ...userArgs) { |
| 197 | const parts = [base]; |
| 198 | for (const t of trusted) parts.push(String(t)); |
| 199 | for (const u of userArgs) parts.push(escapeShellArg(u)); |
| 200 | return parts.join(' '); |
| 201 | } |
| 202 | |
| 203 | // ─── ANSI / control-char stripping ────────────────────────────────────────── |
| 204 |
no test coverage detected