tauri.js 771 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env node
  2. const cmds = ['init', 'dev', 'build', 'help']
  3. const cmd = process.argv[2]
  4. const tauri = function (command) {
  5. if (!command || command === '-h' || command === '--help' || command === 'help') {
  6. console.log(`
  7. Description
  8. This is the Tauri CLI.
  9. Usage
  10. $ tauri ${cmds.join('|')}
  11. Options
  12. --help, -h Displays this message
  13. `)
  14. process.exit(0)
  15. return false// do this for node consumers and tests
  16. }
  17. if (cmds.includes(command)) {
  18. if (process.argv) {
  19. process.argv.splice(2, 1)
  20. }
  21. console.log(`[tauri]: running ${command}`)
  22. require(`./tauri-${command}`)
  23. } else {
  24. console.log(`Invalid command ${command}. Use one of ${cmds.join(',')}.`)
  25. }
  26. }
  27. module.exports = { tauri }
  28. tauri(cmd)