Jelajahi Sumber

feat(tauri.js) add --version option

Lucas Fernandes Gonçalves Nogueira 5 tahun lalu
induk
melakukan
c2b3ac4b05
1 mengubah file dengan 9 tambahan dan 1 penghapusan
  1. 9 1
      cli/tauri.js/bin/tauri.js

+ 9 - 1
cli/tauri.js/bin/tauri.js

@@ -13,6 +13,7 @@ const tauri = function (command) {
   if (typeof command === 'object') { // technically we just care about an array
     command = command[0]
   }
+
   if (!command || command === '-h' || command === '--help' || command === 'help') {
     console.log(`
     Description
@@ -21,11 +22,18 @@ const tauri = function (command) {
       $ tauri ${cmds.join('|')}
     Options
       --help, -h     Displays this message
+      --version, -v  Displays the Tauri CLI version
     `)
     process.exit(0)
     // eslint-disable-next-line no-unreachable
-    return false// do this for node consumers and tests
+    return false // do this for node consumers and tests
+  }
+
+  if (command === '-v' || command === '--version') {
+    console.log(require('../package.json').version)
+    return false // do this for node consumers and tests
   }
+
   if (cmds.includes(command)) {
     if (process.argv && !process.env.test) {
       process.argv.splice(2, 1)