如何查看 NodeJS 命令行工具的可用选项?
How can I view the available options for a NodeJS command line tool?
这个问题适用于各种 NodeJS 命令行工具,但在本例中,我使用的是名为 http-server
.
的 NodeJS 服务器启动器
在命令行上启动此模块时有多个选项可用。例如
http-server -p 8085
在端口 8085 上启动。
有没有什么方法可以让我看到显示的所有可能的选项,而不必上网查看 NPM 文档页面?
有没有
只需使用 --help
标志:
http-server --help
你会看到这个:
options:
-p Port to use [8080]
-a Address to use [0.0.0.0]
-d Show directory listings [true]
-i Display autoIndex [true]
-e --ext Default file extension if none supplied [none]
-s --silent Suppress log messages from output
--cors[=headers] Enable CORS via the "Access-Control-Allow-Origin" header
Optionally provide CORS headers list separated by commas
-o [path] Open browser window after starting the server
-c Cache time (max-age) in seconds [3600], e.g. -c10 for 10 seconds.
To disable caching, use -c-1.
-U --utc Use UTC time format in log messages.
-P --proxy Fallback proxy if the request cannot be resolved. e.g.: http://someurl.com
-S --ssl Enable https.
-C --cert Path to ssl cert file (default: cert.pem).
-K --key Path to ssl key file (default: key.pem).
-r --robots Respond to /robots.txt [User-agent: *\nDisallow: /]
-h --help Print this list and exit.
如果您忘记了,请查看列表中的最后一个选项。
这个问题适用于各种 NodeJS 命令行工具,但在本例中,我使用的是名为 http-server
.
在命令行上启动此模块时有多个选项可用。例如
http-server -p 8085
在端口 8085 上启动。
有没有什么方法可以让我看到显示的所有可能的选项,而不必上网查看 NPM 文档页面? 有没有
只需使用 --help
标志:
http-server --help
你会看到这个:
options:
-p Port to use [8080]
-a Address to use [0.0.0.0]
-d Show directory listings [true]
-i Display autoIndex [true]
-e --ext Default file extension if none supplied [none]
-s --silent Suppress log messages from output
--cors[=headers] Enable CORS via the "Access-Control-Allow-Origin" header
Optionally provide CORS headers list separated by commas
-o [path] Open browser window after starting the server
-c Cache time (max-age) in seconds [3600], e.g. -c10 for 10 seconds.
To disable caching, use -c-1.
-U --utc Use UTC time format in log messages.
-P --proxy Fallback proxy if the request cannot be resolved. e.g.: http://someurl.com
-S --ssl Enable https.
-C --cert Path to ssl cert file (default: cert.pem).
-K --key Path to ssl key file (default: key.pem).
-r --robots Respond to /robots.txt [User-agent: *\nDisallow: /]
-h --help Print this list and exit.
如果您忘记了,请查看列表中的最后一个选项。