Commit 9780c95
Changed files (1)
zx.mjs
@@ -30,7 +30,7 @@ try {
if (typeof firstArg === 'undefined' || firstArg[0] === '-') {
let ok = await scriptFromStdin()
if (!ok) {
- console.log(`usage: zx <script>`)
+ printUsage()
process.exit(2)
}
} else if (firstArg.startsWith('http://') || firstArg.startsWith('https://')) {
@@ -189,3 +189,11 @@ async function compile(input) {
clearInterval(interval)
process.stdout.write(' \r')
}
+
+function printUsage() {
+ console.log(
+ 'usage: zx [--quiet] [--shell=<path>]\n' +
+ ' [--prefix=<command>]\n' +
+ ' <script>'
+ )
+}