Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass arguments after -- through to the script #5

Closed
deanrad opened this issue Apr 11, 2016 · 2 comments
Closed

Pass arguments after -- through to the script #5

deanrad opened this issue Apr 11, 2016 · 2 comments

Comments

@deanrad
Copy link

deanrad commented Apr 11, 2016

Since npm/npm#3494, if I want to pass args to the script run by npm run (as distinct from passing args to npm), I pass them after a --.

npm run test -- --grep 'specific test' #<- these are args for mocha, not for npm

@deanrad
Copy link
Author

deanrad commented Apr 11, 2016

npm run test -- --foo bar # test command is `scripty` in package.json

> project@1.0.0 test /Users/deanius/src/project
> scripty "--foo" "bar"

Executing "/project/scripts/test.sh":

> #!/bin/bash
> echo $@
>

Nothing is echoed - scripty should pass its arguments through, and docs should
show that this use case is supported.

deanrad pushed a commit to deanrad/scripty that referenced this issue Apr 11, 2016
deanrad pushed a commit to deanrad/scripty that referenced this issue Apr 11, 2016
@searls
Copy link
Member

searls commented Apr 11, 2016

It looks like what's happening is that npm is indeed passing those args to scripty and then scripty is dutifully doing nothing with them, since it doesn't look at ARGV. I suspect the fix is to just pass whatever args it receives on to the script it invokes via spawn

deanrad pushed a commit to deanrad/scripty that referenced this issue Apr 12, 2016
Verify that user-provided args are passed through if script references $@

Readme and cleanup
This was referenced Apr 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants