Skip to content

Commit cd8585b

Browse files
committed
fix(cli): fix updateArgv block
1 parent 75a9549 commit cd8585b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cli.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ async function runScript(
151151

152152
async function readScript() {
153153
const [firstArg] = argv._
154-
updateArgv(argv._.slice(firstArg === undefined ? 0 : 1))
155-
156154
let script = ''
157155
let scriptPath = ''
158156
let tempPath = ''
157+
let argSlice = 1
159158

160159
if (argv.eval) {
160+
argSlice = 0
161161
script = argv.eval
162162
tempPath = getFilepath($.cwd, 'zx', argv.ext)
163163
} else if (!firstArg || firstArg === '-') {
@@ -169,7 +169,6 @@ async function readScript() {
169169
throw new Error('No script provided')
170170
}
171171
} else if (/^https?:/.test(firstArg)) {
172-
script = await readScriptFromHttp(firstArg)
173172
const { name, ext = argv.ext } = path.parse(new URL(firstArg).pathname)
174173
tempPath = getFilepath($.cwd, name, ext)
175174
} else {
@@ -187,6 +186,7 @@ async function readScript() {
187186
script = transformMarkdown(script)
188187
tempPath = getFilepath(dir, base)
189188
}
189+
if (argSlice) updateArgv(argv._.slice(1))
190190

191191
return { script, scriptPath, tempPath }
192192
}

0 commit comments

Comments
 (0)