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.

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