2017-02-14 20:27:08 +00:00
|
|
|
#!/usr/bin/env node
|
2017-02-14 07:17:25 +00:00
|
|
|
'use strict'
|
|
|
|
|
2017-02-26 23:06:20 +00:00
|
|
|
// ===========================================
|
|
|
|
// Wiki.js
|
|
|
|
// 1.0.0
|
|
|
|
// Licensed under AGPLv3
|
|
|
|
// ===========================================
|
|
|
|
|
2017-04-19 00:23:42 +00:00
|
|
|
const init = require('./init')
|
|
|
|
|
|
|
|
require('yargs') // eslint-disable-line no-unused-expressions
|
|
|
|
.usage('Usage: node $0 <cmd> [args]')
|
|
|
|
.command({
|
|
|
|
command: 'start',
|
|
|
|
alias: ['boot', 'init'],
|
|
|
|
desc: 'Start Wiki.js process',
|
|
|
|
handler: argv => {
|
|
|
|
init.startDetect()
|
2017-04-18 02:44:04 +00:00
|
|
|
}
|
2017-02-14 07:17:25 +00:00
|
|
|
})
|
2017-04-19 00:23:42 +00:00
|
|
|
.command({
|
|
|
|
command: 'stop',
|
|
|
|
alias: ['quit', 'exit'],
|
|
|
|
desc: 'Stop Wiki.js process',
|
|
|
|
handler: argv => {
|
|
|
|
init.stop()
|
|
|
|
}
|
2017-02-14 07:17:25 +00:00
|
|
|
})
|
2017-04-19 00:23:42 +00:00
|
|
|
.command({
|
|
|
|
command: 'restart',
|
|
|
|
alias: ['reload'],
|
|
|
|
desc: 'Restart Wiki.js process',
|
|
|
|
handler: argv => {
|
|
|
|
init.restart()
|
|
|
|
}
|
2017-02-26 23:06:20 +00:00
|
|
|
})
|
2017-04-19 00:23:42 +00:00
|
|
|
.command({
|
|
|
|
command: 'configure [port]',
|
|
|
|
alias: ['config', 'conf', 'cfg', 'setup'],
|
|
|
|
desc: 'Configure Wiki.js using the web-based setup wizard',
|
|
|
|
builder: (yargs) => yargs.default('port', 3000),
|
|
|
|
handler: argv => {
|
|
|
|
init.configure(argv.port)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.recommendCommands()
|
|
|
|
.demandCommand(1, 'You must provide one of the accepted commands above.')
|
|
|
|
.help()
|
|
|
|
.version()
|
|
|
|
.epilogue('Read the docs at https://wiki.requarks.io')
|
|
|
|
.argv
|