2019-11-18 00:30:14 +03:00
|
|
|
const parseArgs = require('minimist')
|
2019-08-20 00:09:29 +03:00
|
|
|
|
2019-10-07 21:36:56 +03:00
|
|
|
/**
|
|
|
|
* @type {object}
|
|
|
|
* @property {boolean} h
|
|
|
|
* @property {boolean} help
|
|
|
|
* @property {string|boolean} f
|
|
|
|
* @property {string|boolean} force
|
|
|
|
* @property {boolean} l
|
|
|
|
* @property {boolean} log
|
2019-11-18 00:30:14 +03:00
|
|
|
* @property {boolean} d
|
|
|
|
* @property {boolean} directory
|
2019-10-07 21:36:56 +03:00
|
|
|
*/
|
2019-08-20 00:09:29 +03:00
|
|
|
const argv = parseArgs(process.argv.slice(2), {
|
2019-11-16 21:51:46 +03:00
|
|
|
alias: {
|
|
|
|
h: 'help',
|
|
|
|
f: 'force',
|
|
|
|
l: 'log',
|
2019-11-30 14:48:39 +03:00
|
|
|
d: 'directory',
|
2019-12-04 23:49:14 +03:00
|
|
|
t: 'tauri-path'
|
2019-11-16 21:51:46 +03:00
|
|
|
},
|
|
|
|
boolean: ['h', 'l']
|
2019-08-20 00:09:29 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
if (argv.help) {
|
2019-11-16 21:51:46 +03:00
|
|
|
console.log(`
|
2019-08-20 00:09:29 +03:00
|
|
|
Description
|
2019-12-26 17:24:36 +03:00
|
|
|
Inits the Tauri template. If Tauri cannot find the tauri.conf.json
|
2019-10-07 21:36:56 +03:00
|
|
|
it will create one.
|
2019-08-20 00:09:29 +03:00
|
|
|
Usage
|
|
|
|
$ tauri init
|
|
|
|
Options
|
2019-11-30 14:48:39 +03:00
|
|
|
--help, -h Displays this message
|
|
|
|
--force, -f Force init to overwrite [conf|template|all]
|
|
|
|
--log, -l Logging [boolean]
|
|
|
|
--directory, -d Set target directory for init
|
2019-12-04 23:49:14 +03:00
|
|
|
--tauri-path, -t Path of the Tauri project to use (relative to the cwd)
|
2019-11-16 21:51:46 +03:00
|
|
|
`)
|
|
|
|
process.exit(0)
|
2019-08-20 00:09:29 +03:00
|
|
|
}
|
|
|
|
|
2019-12-24 15:40:03 +03:00
|
|
|
const init = require('../dist/init')
|
2019-10-07 21:36:56 +03:00
|
|
|
|
2019-12-10 23:44:49 +03:00
|
|
|
init({
|
|
|
|
directory: argv.d || process.cwd(),
|
2019-11-30 14:48:39 +03:00
|
|
|
force: argv.f || null,
|
|
|
|
logging: argv.l || null,
|
|
|
|
tauriPath: argv.t || null
|
|
|
|
})
|