admin管理员组文章数量:1319022
I have a simple CLI written with Node.js. I want to debug that CLI with VSCode's built in debugging system but, I don't know how to attach the necessary mands to the debugger, whether it be parameters in the package.json or the launch.json, or both.
Let's say the CLI functions has the following mand syntax:
> my_cool_cli <mand>
In application, I'd do this:
> my_cool_cli start
And it would print:
Hello world!
Assume that the CLI is built using the mander library. It has been linked with npm, installed, it's globally accessible, and I can run it with no issues (other than all the unseen bugs) from the standard terminal.
I find that when I enter my_cool_cli start
, it does not return 'Hello world!' as it should, because there is a bug. How can I debug this CLI with VSCode?
I have a simple CLI written with Node.js. I want to debug that CLI with VSCode's built in debugging system but, I don't know how to attach the necessary mands to the debugger, whether it be parameters in the package.json or the launch.json, or both.
Let's say the CLI functions has the following mand syntax:
> my_cool_cli <mand>
In application, I'd do this:
> my_cool_cli start
And it would print:
Hello world!
Assume that the CLI is built using the mander library. It has been linked with npm, installed, it's globally accessible, and I can run it with no issues (other than all the unseen bugs) from the standard terminal.
I find that when I enter my_cool_cli start
, it does not return 'Hello world!' as it should, because there is a bug. How can I debug this CLI with VSCode?
1 Answer
Reset to default 7In order to debug with the console mands, the mands have to be passed as arguments in launch.json
within the given launch configuration.
{
"type": "node",
"request": "launch",
"name": "Launch My Cool CLI",
"program": "${workspaceFolder}//index.js",
"args": [
"start"
]
}
There is no need to provide the application name my_cool_cli
in the arguments.
本文标签: javascriptHow do I debug a CLI with VSCodeStack Overflow
版权声明:本文标题:javascript - How do I debug a CLI with VSCode? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742051223a2418072.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论