Description
Describe the bug
With a CLI like this (https://github.com/JordanMartinez/purs-installer/blob/master/purs-installer-bin/src/Main.purs#L34), this library doesn't parse the following correctly:
node index.js -- --version
due to the appearance of --
. In this context, --
indicates to node
that the following args are meant for the program being run, not node
specifically.
Using the below repo and its instructions, the current test I have fails with:
Current output of the test:
Running tests for package: purs-installer-bin
spec
✗ binary is executable:
Command failed with exit code 1: node /path/to/repo/purs-installer/bin/index.js -- --version
Missing: --purs-version VERSION
The --purs-version
arg is a required arg for the second parser, the CLI one. However, the first parser, the version one, runs before the CLI one and always succeeds if its flag exists.
So, either I'm using this library wrong (which is entirely possible) or this library doesn't provide a way (that I know of) to indicate which args to drop.
To Reproduce
git clone https://github.com/jordanMartinez/purs-installer.git
cd purs-installer
git checkout d4cd1358b38ebf2089ea51d21907fddf7ff83708
# in https://github.com/JordanMartinez/purs-installer/blob/d4cd1358b38ebf2089ea51d21907fddf7ff83708/purs-installer-bin/test/Test/PursInstaller/Setup.purs#L54
# modify the line to the following
# ([ Path.concat [ oldCwd, "bin", "index.js" ] ] <> [ "--" ] <> args) (_
npm i
npx spago test -p purs-installer-bin
Expected behavior
The test should pass.