-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
yarn run pass parameters to multiple commands? #5207
Comments
Unfortunately no, the extra parameters are simply added at the end of the command. |
Bummer... so there is no way to string commands together with parameters? I can't believe I've never run into this before. |
I love yarn's with more succinct error messages with |
Ha. I guess yarn's implementation is much more what I originally wanted npm's be. Nice. Sorry for jumping in here. |
@chadbr you could at least make a JS script to accomplish that if nothing else.
Don't you mean |
New to yarn, but surprised to see this basic thing missing !! Not blaming the community. I will also look into this, but till now I have heard that |
Fyi and assuming good intent, know that this is kinda rude. What you deem a basic thing is maybe less important to us than other things you take for granted, like installing packages right. And for what it's worth, albeit undocumented at the moment, this feature will be available in the next major (it'll work just like bash, so you'd write |
@arcanis, apologies if I sounded rude on this. & yes the comment was intended for good only. My only concern was no update on the same. Most of the places such things are either closed or properly tagged like backlog, enhancement! Anyways good to hear that it will be there ❤️ |
@arcanis This is awesome to hear! Do you have a link to the commit or PR that added this? |
Not a commit (this was done at the beginning of the v2, about a year ago), but we've implemented it here: https://github.com/yarnpkg/berry/tree/master/packages/berry-shell |
Very cool! When's 1.18 expected to land? |
Soon, but the feature mentioned in my post is in the next major, which will only come in a few months (you're welcome to try it now, however 😉). |
Oops, didn't read that carefully enough. How do I try it out? |
The install instructions are here: https://next.yarnpkg.com/getting-started/install |
As a workaround, leverage the fact that yarn 1.x runs the command inside a shell and use that shell's function defining syntax. For example:
For this example I know yarn will use
Once inside a function, you can slice and dice arguments. As an example:
That extracts the first argument and puts after the |
The reply by @bishopb should just be added to the docs. Outstanding answer, and thank you for sharing. |
I think this issue can be closed, correct? Yarn 2.x is long out now and seems like it supports the |
For those who have no idea what @bishopb's answer means or how to use it, here's a simpler version: Add this to "new": "f() { touch ./src/data/articles/\"$1\"/\"$2\".md; }; f" and run this: yarn new project figma which is the equivalent of touch './src/data/articles/project/figma.md' |
yarn 1.3.2
Is there some way I can pass a parameter to multiple commands?
If I run
yarn run start --param=foo
; the index.js will receive the --param=fooIf I dun
yarn run funstart --param=foo
; the index.js will not receive the --param=fooIs there some way to pass arguments to multiple commands (without writing a "setupAndRunIndex.js")
thanks!
The text was updated successfully, but these errors were encountered: