Make a script which accept command-line arguments

前端 未结 5 1486
长情又很酷
长情又很酷 2021-01-01 08:38

What is the correct syntax for running a Node.js script with command-line arguments on Linux or Mac?

To run the script with no arguments, I would simply use the comm

5条回答
  •  清歌不尽
    2021-01-01 09:14

    If you want to do more sophisticated stuff, the following modules are really helpful:

    • yargs by Benjamin Coe
    • commander by TJ Holowaychuk
    • vorpal by David Caccavella
    • nopt by Isaac Schlueter

    And for fun

    • cli-table by Guillermo Rauch
    • node-multimeter by substack
    • chalk by Sindre Sorhus

提交回复
热议问题