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.

67 lines
1.7 KiB

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,
  28. description: 'Verbose output, useful for debugging.', group: 'misc'
  29. }
  30. ]
  31. function usage (middlewareDefinitions) {
  32. return [
  33. {
  34. header: 'local-web-server',
  35. content: 'A simple web-server for productive front-end development.'
  36. },
  37. {
  38. header: 'Synopsis',
  39. content: [
  40. '$ ws [<server options>]',
  41. '$ ws --config',
  42. '$ ws --help'
  43. ]
  44. },
  45. {
  46. header: 'Server',
  47. optionList: exports.optionDefinitions,
  48. group: 'server'
  49. },
  50. {
  51. header: 'Middleware',
  52. optionList: middlewareDefinitions,
  53. group: 'middleware'
  54. },
  55. {
  56. header: 'Misc',
  57. optionList: exports.optionDefinitions,
  58. group: 'misc'
  59. },
  60. {
  61. content: 'Project home: [underline]{https://github.com/75lb/local-web-server}'
  62. }
  63. ]
  64. }
  65. exports.usage = usage