You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB

  1. #!/usr/bin/env node
  2. 'use strict'
  3. // ===========================================
  4. // Wiki.js
  5. // 1.0.0
  6. // Licensed under AGPLv3
  7. // ===========================================
  8. const init = require('./server/init')
  9. require('yargs') // eslint-disable-line no-unused-expressions
  10. .usage('Usage: node $0 <cmd> [args]')
  11. .command({
  12. command: 'start',
  13. alias: ['boot', 'init'],
  14. desc: 'Start Wiki.js process',
  15. handler: argv => {
  16. init.startDetect()
  17. }
  18. })
  19. .command({
  20. command: 'stop',
  21. alias: ['quit', 'exit'],
  22. desc: 'Stop Wiki.js process',
  23. handler: argv => {
  24. init.stop()
  25. }
  26. })
  27. .command({
  28. command: 'restart',
  29. alias: ['reload'],
  30. desc: 'Restart Wiki.js process',
  31. handler: argv => {
  32. init.restart()
  33. }
  34. })
  35. .command({
  36. command: 'configure [port]',
  37. alias: ['config', 'conf', 'cfg', 'setup'],
  38. desc: 'Configure Wiki.js using the web-based setup wizard',
  39. builder: (yargs) => yargs.default('port', 3000),
  40. handler: argv => {
  41. init.configure(argv.port)
  42. }
  43. })
  44. .recommendCommands()
  45. .demandCommand(1, 'You must provide one of the accepted commands above.')
  46. .help()
  47. .version()
  48. .epilogue('Read the docs at https://wiki.requarks.io')
  49. .argv