diff --git a/README.md b/README.md index 2318173..161ec69 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,50 @@ A simple web-server for productive front-end development. Typical use cases: **Requires node v4.0.0 or higher**. ## Synopsis +local-web-server is a simple command-line tool. To use it, from your project directory run `ws`. + +

+$ ws --help
+
+local-web-server
+
+  A simple web-server for productive front-end development.
+
+Synopsis
+
+  $ ws []
+  $ ws --config
+  $ ws --help
+
+Server
+
+  -p, --port number              Web server port.
+  -d, --directory path           Root directory, defaults to the current directory.
+  -f, --log-format string        If a format is supplied an access log is written to
+                                 stdout. If not, a dynamic statistics view is displayed.
+                                 Use a preset ('none', 'dev','combined', 'short', 'tiny'
+                                 or 'logstalgia') or supply a custom format (e.g.
+                                 ':method -> :url').
+  -r, --rewrite expression ...   A list of URL rewrite rules. For each rule, separate the
+                                 'from' and 'to' routes with '->'. Whitespace surrounded
+                                 the routes is ignored. E.g. '/from -> /to'.
+  -s, --spa file                 Path to a Single Page App, e.g. app.html.
+  -c, --compress                 Serve gzip-compressed resources, where applicable.
+  -b, --forbid path ...          A list of forbidden routes.
+  -n, --no-cache                 Disable etag-based caching -forces loading from disk
+                                 each request.
+  --verbose                      Verbose output, useful for debugging.
+
+Misc
+
+  -h, --help    Print these usage instructions.
+  --config      Print the stored config.
+
+  Project home: https://github.com/75lb/local-web-server
+
+ +## Examples + For the examples below, we assume we're in a project directory looking like this: ```sh diff --git a/jsdoc2md/README.hbs b/jsdoc2md/README.hbs index f73e82e..0ebca19 100644 --- a/jsdoc2md/README.hbs +++ b/jsdoc2md/README.hbs @@ -26,6 +26,50 @@ A simple web-server for productive front-end development. Typical use cases: **Requires node v4.0.0 or higher**. ## Synopsis +local-web-server is a simple command-line tool. To use it, from your project directory run `ws`. + +

+$ ws --help
+
+local-web-server
+
+  A simple web-server for productive front-end development.
+
+Synopsis
+
+  $ ws []
+  $ ws --config
+  $ ws --help
+
+Server
+
+  -p, --port number              Web server port.
+  -d, --directory path           Root directory, defaults to the current directory.
+  -f, --log-format string        If a format is supplied an access log is written to
+                                 stdout. If not, a dynamic statistics view is displayed.
+                                 Use a preset ('none', 'dev','combined', 'short', 'tiny'
+                                 or 'logstalgia') or supply a custom format (e.g.
+                                 ':method -> :url').
+  -r, --rewrite expression ...   A list of URL rewrite rules. For each rule, separate the
+                                 'from' and 'to' routes with '->'. Whitespace surrounded
+                                 the routes is ignored. E.g. '/from -> /to'.
+  -s, --spa file                 Path to a Single Page App, e.g. app.html.
+  -c, --compress                 Serve gzip-compressed resources, where applicable.
+  -b, --forbid path ...          A list of forbidden routes.
+  -n, --no-cache                 Disable etag-based caching -forces loading from disk
+                                 each request.
+  --verbose                      Verbose output, useful for debugging.
+
+Misc
+
+  -h, --help    Print these usage instructions.
+  --config      Print the stored config.
+
+  Project home: https://github.com/75lb/local-web-server
+
+ +## Examples + For the examples below, we assume we're in a project directory looking like this: ```sh diff --git a/lib/cli-options.js b/lib/cli-options.js index 1940a35..2578f4e 100644 --- a/lib/cli-options.js +++ b/lib/cli-options.js @@ -2,47 +2,47 @@ module.exports = { definitions: [ { name: 'port', alias: 'p', type: Number, defaultOption: true, - description: 'Web server port', group: 'server' + description: 'Web server port.', group: 'server' + }, + { + name: 'directory', alias: 'd', type: String, typeLabel: '[underline]{path}', + description: 'Root directory, defaults to the current directory.', group: 'server' }, { name: 'log-format', alias: 'f', type: String, description: "If a format is supplied an access log is written to stdout. If not, a dynamic statistics view is displayed. Use a preset ('none', 'dev','combined', 'short', 'tiny' or 'logstalgia') or supply a custom format (e.g. ':method -> :url').", group: 'server' }, { - name: 'directory', alias: 'd', type: String, - description: 'Root directory, defaults to the current directory', group: 'server' + name: 'rewrite', alias: 'r', type: String, multiple: true, typeLabel: '[underline]{expression} ...', + description: "A list of URL rewrite rules. For each rule, separate the 'from' and 'to' routes with '->'. Whitespace surrounded the routes is ignored. E.g. '/from -> /to'.", group: 'server' + }, + { + name: 'spa', alias: 's', type: String, typeLabel: '[underline]{file}', + description: 'Path to a Single Page App, e.g. app.html.', group: 'server' }, { name: 'compress', alias: 'c', type: Boolean, - description: 'Serve gzip-compressed resources, where applicable', group: 'server' + description: 'Serve gzip-compressed resources, where applicable.', group: 'server' }, { name: 'forbid', alias: 'b', type: String, multiple: true, typeLabel: '[underline]{path} ...', - description: 'A list of forbidden routes', group: 'server' + description: 'A list of forbidden routes.', group: 'server' }, { name: 'no-cache', alias: 'n', type: Boolean, description: 'Disable etag-based caching - forces loading from disk each request.', group: 'server' }, { - name: 'rewrite', alias: 'r', type: String, multiple: true, typeLabel: '[underline]{expression} ...', - description: "A list of URL rewrite rules. For each rule, separate the 'from' and 'to' routes with '->'. Whitespace surrounded the routes is ignored. E.g. '/from -> /to'", group: 'server' - }, - { - name: 'spa', alias: 's', type: String, typeLabel: '[underline]{file}', - description: 'Path to a Single Page App, e.g. app.html', group: 'server' - }, - { name: 'verbose', type: Boolean, description: 'Verbose output, useful for debugging.', group: 'server' }, { name: 'help', alias: 'h', type: Boolean, - description: 'Print these usage instructions', group: 'misc' + description: 'Print these usage instructions.', group: 'misc' }, { name: 'config', type: Boolean, - description: 'Print the config local-web-server would be launched with, then exit', group: 'misc' + description: 'Print the stored config.', group: 'misc' } ], usageData: {