nodeca / argparse

CLI arguments parser for node.js. JS port of python's argparse module.
Other
487 stars 73 forks source link

v2 cannot be used with ts-node anymore #150

Closed timocov closed 4 years ago

timocov commented 4 years ago

When you run scripts written in TypeScript with ts-node process.argv looks like

[
  '/path/to/project-root/node_modules/ts-node/dist/bin.js',
  '/path/to/project-root/path/to/script-name.ts',
  // ... all other cli args here
]

In 1.x version it was parsed correctly, but since 2.0 it throws bin.js: error: unrecognized arguments: /path/to/project-root/path/to/script-name.ts. Probably the issue is somewhere here, because the first arg isn't process.execPath. I'm not sure whether it's ts-node's issue, please let me know if it is so.

rlidwka commented 4 years ago

Fixed in https://github.com/nodeca/argparse/commit/10fd15512ae6c3450696246463966e35d019fc27. Definitely not ts-node issue.

timocov commented 4 years ago

Thanks!