mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-19 16:41:34 +03:00
3ce95d2760
* feat(tauri.js) add `tauri info` command * fix(bug-report): add command information - thanks @nklayman for the reminder * fix(tauri-info): add cargo version * feat(tauri.js) add cargo.toml and tauri.conf.json info Co-authored-by: nothingismagick <drthompsonsmagickindustries@gmail.com>
51 lines
1.4 KiB
JavaScript
Executable File
51 lines
1.4 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
const cmds = ['init', 'dev', 'build', 'help', 'icon', 'info']
|
|
|
|
const cmd = process.argv[2]
|
|
/**
|
|
* @description This is the bootstrapper that in turn calls subsequent
|
|
* Tauri Commands
|
|
*
|
|
* @param {string|array} command
|
|
*/
|
|
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
|
|
This is the Tauri CLI.
|
|
Usage
|
|
$ 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
|
|
}
|
|
|
|
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)
|
|
}
|
|
console.log(`[tauri]: running ${command}`)
|
|
// eslint-disable-next-line security/detect-non-literal-require
|
|
require(`./tauri-${command}`)
|
|
} else {
|
|
console.log(`Invalid command ${command}. Use one of ${cmds.join(',')}.`)
|
|
}
|
|
}
|
|
module.exports = { tauri }
|
|
|
|
tauri(cmd)
|