commander.js: Not compatible with `Node v6.0.0` or `Node v6.1.0`?

It’s strange that when I switch to Node v6.1.0 to execute my app.js -h, just to find the output help content was truncated as:


  Usage: index [options]

  qut is a command line tool for Stock Analysis and Research.

  Options:

    -h, --help             output usage information
    -V, --version          output the version number
    -p, --page   <n>       specify the page index to display.
    -l, --limit  <n>       set total display limit of current page.
    -s, --sort   <sort>    specify field to sort by.
    -f, --format           enable or disable number format.
    -o, --order  <order>   specify order direction: asc or desc.
    -q, --query  <query>   specify collection to query from mongodb. available collections: earning,cal,
                           forecast,fund,gsz,holder,hotspot,insider,investigation,issuance,restrict,
                           shareholder
    -u, --update <update>  update certain datas, available data types: all,quote,cia,range,cal,insider,
                           holder,margin,account,transfer,gsz,forecast,earning,hgt,restrict,price,fprice,
                           dd,fdd,ihustcer@~/github/swift-quant$

When I switch back to Node v5.11.1, it works well:


  Usage: index [options]

  qut is a command line tool for Stock Analysis and Research.

  Options:

    -h, --help             output usage information
    -V, --version          output the version number
    -p, --page   <n>       specify the page index to display.
    -l, --limit  <n>       set total display limit of current page.
    -s, --sort   <sort>    specify field to sort by.
    -f, --format           enable or disable number format.
    -o, --order  <order>   specify order direction: asc or desc.
    -q, --query  <query>   specify collection to query from mongodb. available collections: earning,cal,
                           forecast,fund,gsz,holder,hotspot,insider,investigation,issuance,restrict,
                           shareholder
    -u, --update <update>  update certain datas, available data types: all,quote,cia,range,cal,insider,
                           holder,margin,account,transfer,gsz,forecast,earning,hgt,restrict,price,fprice,
                           dd,fdd,issuance,investigate,shareholder,hotspot.
    -Q, --quant <quant>    filter stocks, available filter types: discount,forecast,earning,insider,gsz,
                           10holder,investigate,shareholder,fund,issuance.
    -S, --stat  <stat>     data statistic, available stat types: insider,insider-week,insider-month,dd,
                           dd-day,dd-week.
    -O, --optimize         filter stocks in optimized way!
    -g, --grep  <kw>       specify the keyword to grep in name or concept, multiple keywords should be
                           separated by ",".

Whether this is a bug or not?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21

Most upvoted comments

@hustcer @cbetta @zhiyelee I pulled the tiny bit of logic that yargs uses to solve this problem into a shim:

https://github.com/yargs/set-blocking

UglifyJS2 uses this same approach, which I modeled yargs’ fix after: https://github.com/mishoo/UglifyJS2/pull/1061/files

oh, interesting. I will check that, and PR is welcome

@cbetta that’s what https://github.com/yargs/set-blocking does, also the issue will be fixed soon in core, see https://github.com/nodejs/node/issues/6980.