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.

87 lines
2.2 KiB

9 years ago
9 years ago
8 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: 'Feature 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: 'view', type: String,
  28. description: 'Custom view', group: 'misc'
  29. },
  30. {
  31. name: 'config', type: Boolean,
  32. description: 'Print the stored config.', group: 'misc'
  33. },
  34. {
  35. name: 'config-file', type: String,
  36. description: 'Config file to use', group: 'misc'
  37. },
  38. {
  39. name: 'verbose', type: Boolean, alias: 'v',
  40. description: 'Verbose output.', group: 'misc'
  41. },
  42. {
  43. name: 'debug', type: Boolean,
  44. description: 'Very verbose output, intended for debugging.', group: 'misc'
  45. },
  46. {
  47. name: 'version', type: Boolean,
  48. description: 'Print the version number.', group: 'misc'
  49. }
  50. ]
  51. function usage (middlewareDefinitions) {
  52. return [
  53. {
  54. header: 'local-web-server',
  55. content: 'A simple web-server for productive front-end development.'
  56. },
  57. {
  58. header: 'Synopsis',
  59. content: [
  60. '$ ws [--verbose] [<server options>] [<middleware options>]',
  61. '$ ws --config',
  62. '$ ws --help'
  63. ]
  64. },
  65. {
  66. header: 'Server',
  67. optionList: exports.optionDefinitions,
  68. group: 'server'
  69. },
  70. {
  71. header: 'Middleware',
  72. optionList: middlewareDefinitions,
  73. group: 'middleware'
  74. },
  75. {
  76. header: 'Misc',
  77. optionList: exports.optionDefinitions,
  78. group: 'misc'
  79. },
  80. {
  81. content: 'Project home: [underline]{https://github.com/75lb/local-web-server}'
  82. }
  83. ]
  84. }
  85. exports.usage = usage