【发布时间】:2020-01-13 07:51:33
【问题描述】:
在 Visual Studio Code 中,在启动我正在编写的应用程序的 launch.json 文件中,如何添加命令行参数?
【问题讨论】:
标签: node.js visual-studio-code command-line-arguments
在 Visual Studio Code 中,在启动我正在编写的应用程序的 launch.json 文件中,如何添加命令行参数?
【问题讨论】:
标签: node.js visual-studio-code command-line-arguments
如documentation 中所述,您需要使用args 属性。 例如
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug App",
"program": "${workspaceFolder}/main.js",
"args": ["arg1", "arg2", "arg3"]
}
]
}
【讨论】:
"args": ["key=value", "key=value"]
我通过这种方式为python程序传递参数,它可能适用于nodejs:
{
"type": "node",
"request": "launch",
"name": "Debug App",
"program": "${workspaceFolder}/main.js",
"args": ["--arg1", "value1", "--arg2", "value2"]
}
【讨论】: