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.

71 lines
1.9 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. exports.optionDefinitions = [
  2. {
  3. name: 'port', alias: 'p', type: Number, defaultOption: true,
  4. description: 'Web server port.', group: 'server'
  5. },
  6. {
  7. name: 'key', type: String, typeLabel: '[underline]{file}', group: 'server',
  8. description: 'SSL key. Supply along with --cert to launch a https server.'
  9. },
  10. {
  11. name: 'cert', type: String, typeLabel: '[underline]{file}', group: 'server',
  12. description: 'SSL cert. Supply along with --key to launch a https server.'
  13. },
  14. {
  15. name: 'https', type: Boolean, group: 'server',
  16. description: 'Enable HTTPS using a built-in key and cert, registered to the domain 127.0.0.1.'
  17. },
  18. {
  19. name: 'help', alias: 'h', type: Boolean,
  20. description: 'Print these usage instructions.', group: 'misc'
  21. },
  22. {
  23. name: 'config', type: Boolean,
  24. description: 'Print the stored config.', group: 'misc'
  25. },
  26. {
  27. name: 'verbose', type: Boolean, alias: 'v',
  28. description: 'Verbose output, useful for debugging.', group: 'misc'
  29. },
  30. {
  31. name: 'version', type: Boolean,
  32. description: 'Print the version number.', group: 'misc'
  33. }
  34. ]
  35. function usage (middlewareDefinitions) {
  36. return [
  37. {
  38. header: 'local-web-server',
  39. content: 'A simple web-server for productive front-end development.'
  40. },
  41. {
  42. header: 'Synopsis',
  43. content: [
  44. '$ ws [--verbose] [<server options>] [<middleware options>]',
  45. '$ ws --config',
  46. '$ ws --help'
  47. ]
  48. },
  49. {
  50. header: 'Server',
  51. optionList: exports.optionDefinitions,
  52. group: 'server'
  53. },
  54. {
  55. header: 'Middleware',
  56. optionList: middlewareDefinitions,
  57. group: 'middleware'
  58. },
  59. {
  60. header: 'Misc',
  61. optionList: exports.optionDefinitions,
  62. group: 'misc'
  63. },
  64. {
  65. content: 'Project home: [underline]{https://github.com/75lb/local-web-server}'
  66. }
  67. ]
  68. }
  69. exports.usage = usage