rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush] Allow custom commands with pass-through parameters

Open Faithfinder opened this issue 2 years ago • 9 comments

I'm trying to integrate knip in our rush repo, and while it's mostly going fine, the custom command I'm using to invoke it is just knip. I would like to be able to pass in any of knip's CLI arguments to it when I invoke, and listing them manually seems like a crazy exercise.

Faithfinder avatar Jan 24 '24 20:01 Faithfinder

It'd be possible to add an option in command-line.json to allow "remainder" parameters to be passed to a bulk process. ts-command-line supports this, but it isn't exposed in Rush.

Would you be interested in adding this feature?

iclanton avatar Jan 31 '24 19:01 iclanton

Meh, maybe. I have very little time/energy to spend on open source, but inspiration could struck and this sounds like it wouldn't take more than an hour. Can you point to a good file to start with for me or whoever takes this?

Faithfinder avatar Jan 31 '24 19:01 Faithfinder

(BTW, the command is global, not bulk, but I imagine it can be implemented and useful for both)

Faithfinder avatar Jan 31 '24 19:01 Faithfinder

@Faithfinder can you please share your config setup to integrate knip with rush? Did you use a rush command? Did you have a single knip config file?

cubabit avatar May 07 '24 09:05 cubabit

@Faithfinder can you please share your config setup to integrate knip with rush? Did you use a rush command? Did you have a single knip config file?

Single file, yes, but I can't share the config as I'm not in that job anymore. Wasn't anything tricky, just ignore rush's config folders and expand entry files in individual projects as needed.

Faithfinder avatar May 15 '24 18:05 Faithfinder

@iclanton could you advise where to make such changes? I'd be happy to file a PR for this but need a bit of guidance as to where to look at this integration.

delarre-reve avatar Aug 16 '24 21:08 delarre-reve

Our CLI parsing library (@rushstack/ts-command-line) already has support for getting the remaining values, so on the Rush side, it'll involve adding option(s) to command-line.json (look for things that use command-line.schema.json) and then plumbing them through to the command objects that get created when a Rush process boots up.

iclanton avatar Aug 17 '24 01:08 iclanton