Skip to content

Commit

Permalink
fix(cli): fix updateArgv block
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jan 11, 2025
1 parent 75a9549 commit cd8585b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ async function runScript(

async function readScript() {
const [firstArg] = argv._
updateArgv(argv._.slice(firstArg === undefined ? 0 : 1))

let script = ''
let scriptPath = ''
let tempPath = ''
let argSlice = 1

if (argv.eval) {
argSlice = 0
script = argv.eval
tempPath = getFilepath($.cwd, 'zx', argv.ext)
} else if (!firstArg || firstArg === '-') {
Expand All @@ -169,7 +169,6 @@ async function readScript() {
throw new Error('No script provided')
}
} else if (/^https?:/.test(firstArg)) {
script = await readScriptFromHttp(firstArg)
const { name, ext = argv.ext } = path.parse(new URL(firstArg).pathname)
tempPath = getFilepath($.cwd, name, ext)
} else {
Expand All @@ -187,6 +186,7 @@ async function readScript() {
script = transformMarkdown(script)
tempPath = getFilepath(dir, base)
}
if (argSlice) updateArgv(argv._.slice(1))

return { script, scriptPath, tempPath }
}
Expand Down

0 comments on commit cd8585b

Please sign in to comment.