Commit 9780c95

Anton Medvedev <anton@medv.io>
2021-07-05 14:52:10
Update usage
1 parent 9912ca6
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>'
+  )
+}