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.

75 lines
2.0 KiB

9 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 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, useful for debugging.', group: 'misc'
  33. },
  34. {
  35. name: 'version', type: Boolean,
  36. description: 'Print the version number.', group: 'misc'
  37. }
  38. ]
  39. function usage (middlewareDefinitions) {
  40. return [
  41. {
  42. header: 'local-web-server',
  43. content: 'A simple web-server for productive front-end development.'
  44. },
  45. {
  46. header: 'Synopsis',
  47. content: [
  48. '$ ws [--verbose] [<server options>] [<middleware options>]',
  49. '$ ws --config',
  50. '$ ws --help'
  51. ]
  52. },
  53. {
  54. header: 'Server',
  55. optionList: exports.optionDefinitions,
  56. group: 'server'
  57. },
  58. {
  59. header: 'Middleware',
  60. optionList: middlewareDefinitions,
  61. group: 'middleware'
  62. },
  63. {
  64. header: 'Misc',
  65. optionList: exports.optionDefinitions,
  66. group: 'misc'
  67. },
  68. {
  69. content: 'Project home: [underline]{https://github.com/75lb/local-web-server}'
  70. }
  71. ]
  72. }
  73. exports.usage = usage