not always

This commit is contained in:
Chris Wanstrath 2025-11-10 01:00:33 -08:00
parent c244435ae2
commit 0c6ce16bcd

View File

@ -9,9 +9,6 @@ import { readFileSync } from 'fs'
import { spawn } from 'child_process' import { spawn } from 'child_process'
import { join } from 'path' import { join } from 'path'
const idx = Bun.argv.indexOf('--')
prelude.$.args = idx >= 0 ? Bun.argv.slice(idx + 1) : []
function showHelp() { function showHelp() {
console.log(`${colors.bright}${colors.magenta}🦐 Shrimp${colors.reset} is a scripting language in a shell. console.log(`${colors.bright}${colors.magenta}🦐 Shrimp${colors.reset} is a scripting language in a shell.
@ -38,6 +35,9 @@ function showVersion() {
} }
async function evalCode(code: string, imports: string[]) { async function evalCode(code: string, imports: string[]) {
const idx = Bun.argv.indexOf('--')
prelude.$.args = idx >= 0 ? Bun.argv.slice(idx + 1) : []
const importStatement = imports.length > 0 ? `import ${imports.join(' ')}` : '' const importStatement = imports.length > 0 ? `import ${imports.join(' ')}` : ''
if (importStatement) code = `${importStatement}; ${code}` if (importStatement) code = `${importStatement}; ${code}`
return await runCode(code) return await runCode(code)