Commit 07d134b
test.mjs
@@ -92,6 +92,11 @@ import path from 'path'
await $`node zx.mjs examples/typescript.ts`
}
+{ // Quiet mode is working
+ let {stdout} = await $`node zx.mjs --quiet examples/markdown.md`
+ assert(!stdout.includes('whoami'))
+}
+
{ // Pipes are working
let {stdout} = await $`echo "hello"`
.pipe($`awk '{print $1" world"}'`)
zx.mjs
@@ -26,8 +26,8 @@ try {
console.log(`zx version ${createRequire(import.meta.url)('./package.json').version}`)
process.exit(0)
}
- let firstArg = process.argv[2]
- if (typeof firstArg === 'undefined' || firstArg[0] === '-') {
+ let firstArg = process.argv.slice(2).find(a => !a.startsWith('--'));
+ if (typeof firstArg === 'undefined' || firstArg === '-') {
let ok = await scriptFromStdin()
if (!ok) {
printUsage()