Skip to content

Commit

Permalink
fix(cli): file protocol check
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jan 7, 2025
1 parent d969840 commit 90e782f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export async function main() {
await scriptFromHttp(firstArg, argv.ext)
return
}
const filepath = firstArg.startsWith('file:///')
const filepath = firstArg.startsWith('file://')
? url.fileURLToPath(firstArg)
: path.resolve(firstArg)
await importPath(filepath)
Expand Down
6 changes: 4 additions & 2 deletions src/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import { inspect } from 'node:util'
import { ProcessOutput, defaults } from './core.js'
import { chalk } from './vendor-core.js'

export async function startRepl() {
const HISTORY = path.join(os.homedir(), '.zx_repl_history')

export async function startRepl(history = HISTORY) {
defaults.verbose = false
const r = repl.start({
prompt: chalk.greenBright.bold('❯ '),
Expand All @@ -32,5 +34,5 @@ export async function startRepl() {
return inspect(output, { colors: true })
},
})
r.setupHistory(path.join(os.homedir(), '.zx_repl_history'), () => {})
r.setupHistory(history, () => {})
}

0 comments on commit 90e782f

Please sign in to comment.