2019-11-18 00:30:14 +03:00
|
|
|
const parseArgs = require('minimist')
|
2020-08-17 20:07:44 +03:00
|
|
|
const tauriCreate = require('./tauri-create')
|
2019-08-20 00:09:29 +03:00
|
|
|
|
2019-10-07 21:36:56 +03:00
|
|
|
/**
|
2020-08-19 05:36:46 +03:00
|
|
|
* init is an alias for create -r none, same as
|
2020-08-17 20:07:44 +03:00
|
|
|
* creating a fresh tauri project with no UI recipe applied.
|
2020-08-19 05:36:46 +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
|
|
|
*/
|
2020-08-17 20:07:44 +03:00
|
|
|
function main(cliArgs) {
|
|
|
|
const argv = parseArgs(cliArgs, {
|
|
|
|
alias: {
|
2020-08-19 05:36:46 +03:00
|
|
|
h: 'help'
|
2020-08-17 20:07:44 +03:00
|
|
|
},
|
|
|
|
boolean: ['h']
|
|
|
|
})
|
|
|
|
|
|
|
|
if (argv.help) {
|
|
|
|
printUsage()
|
|
|
|
process.exit(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
// delegate actual work to create command
|
|
|
|
tauriCreate([...cliArgs, '-r', 'none'])
|
|
|
|
}
|
2019-08-20 00:09:29 +03:00
|
|
|
|
2020-08-17 20:07:44 +03:00
|
|
|
function printUsage() {
|
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
|
2020-07-10 19:19:41 +03:00
|
|
|
--help, -h Displays this message
|
|
|
|
--ci Skip prompts
|
|
|
|
--force, -f Force init to overwrite [conf|template|all]
|
|
|
|
--log, -l Logging [boolean]
|
|
|
|
--directory, -d Set target directory for init
|
|
|
|
--tauri-path, -t Path of the Tauri project to use (relative to the cwd)
|
|
|
|
--app-name, -A Name of your Tauri application
|
|
|
|
--window-title, -W Window title of your Tauri application
|
|
|
|
--dist-dir, -D Web assets location, relative to <project-dir>/src-tauri
|
|
|
|
--dev-path, -P Url of your dev server
|
2019-11-16 21:51:46 +03:00
|
|
|
`)
|
2020-07-10 19:19:41 +03:00
|
|
|
}
|
2019-10-07 21:36:56 +03:00
|
|
|
|
2020-08-17 20:07:44 +03:00
|
|
|
module.exports = main
|