-
Notifications
You must be signed in to change notification settings - Fork 604
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
[rush] rushx should support parameters for commands #1232
Comments
@Toraxis sorry nobody replied until now. For a little background, there's a couple reasons why this wasn't implemented originally:
If I was going to work on this, personally I'd invest my time in the documented/validated design rather than the |
It's sometimes handy to just pass some ad-hoc arguments to existing scripts (e.g. some extra arguments to a test runner while debugging).
This certainly makes sense. Note that Hopefully that could help with keeping the command parser both 'strict' for normal cases, yet also flexible for these cases? |
I'm also running into this but with command-line scripts. I have my own cli for various tasks, but it would be pretty handy to be able to use for example eg It would be a great benefit to be able to use rush as the command runner. It would be nice to have an additional option on the command something like
|
That could work. How would we ensure there is command-line help for such a command? What is the user experience like if someone misspells a parameter name? |
Using yargs I'm getting the following. But there are times I can see you may just want to basically expose another cli and you would have to rely on their own validation. Copying all the options over to the command doesn't sound great, and then in my current use case of positional arguments rush doesn't support.
|
@octogonz Would love to see this implemented. I'd grown accustomed to always using |
Maybe
This way the more structured model is opt-in (and we can implement what you're asking for without waiting for the structured model to be designed/implemented). |
@octogonz That would be great Best of both worlds! |
@octogonz what's the best way to move this forward? Based on a conversation in the gitter chat... I believe people are taking the approach of having a package.json in the root of the project – which is definitely not ideal. |
I also believe there is the need for a global command support. i.e. I want to expose a scaffold generator: |
@dfee Global commands are already supported using |
@devin-fee-ah the "needs design" issue tag is referring to the Rush model I outlined above. We need someone to propose how that would work. For the NPM compatible model, someone just needs to make a PR. It's probably a relatively easy work item. If someone wants to work on it and needs help, feel free to ask in Gitter. Personally I've been pretty swamped recently, but if you ping me directly on Gitter I usually respond fairly quickly. |
Hopefully I can clarify the issue that I'm facing. To use the words of @octogonz as a template: What I'm looking for is this: for a particular command, where the underlying script already performs:
That I could simply pass-through Rush's command line arguments without checking them. The most trivial example, useful for communicating the feature: {
"commandKind": "global",
"name": "echo",
"summary": "passes args to echo",
"shellCommand": "echo"
}, Then: The general use-case (for me) is where I have tools (e.g. scaffolding new projects) that are already built with |
Also, let me be clear - I'm totally willing to attempt a fix at this... but will likely need some shepherding. I wonder if the approach would be creating an override here: https://github.com/microsoft/rushstack/blob/bf36e86d65b5c1dbf083221d13594e88123b081e/libraries/ts-command-line/src/CommandLineAction.ts |
You're right that this needs to start with a |
I made some progress on this. Will aim to put up a PR soon. |
Here's a PR: #1869 It was more work than I thought. :-) Mostly remembering how to use |
I merged the PR. Publishing failed because npm, Inc. seems to have a major outage, but that shouldn't block the next step for rushx. Edit: We successfully published @rushstack/ts-command-line 4.4.0. |
So it looks like the next steps are:
|
I'll take care of #1. If you have questions about the other steps, I'm also reachable on Gitter. |
This should take care of #1: microsoft/rushstack.io-website#15 Seems like the API docs haven't been updated in a while. :-) |
@octogonz It seems like 2. was not addressed yet to allow rush Any plans to add this? It would greatly improve the rush experience IMO |
We want to use
rushx
as a drop-in replacement fornpm run
but we are missing the ability to pass through the remainder of the command line to the invoked script. For example, we would like to callrushx foo bar baz
and it should run the script namedfoo
with the command linebar baz
.The text was updated successfully, but these errors were encountered: