open-cli-tools / concurrently

Run commands concurrently. Like `npm run watch-js & npm run watch-less` but better.
https://www.npmjs.com/package/concurrently
MIT License
7k stars 228 forks source link

Filter for output of specific commands #434

Open reknih opened 1 year ago

reknih commented 1 year ago

Description: Allow me to filter which command outputs I want to display. Still run all tasks.

Use case: I want to debug a particular task of the set of tasks I run with concurrently and focus on its outputs. At the moment, I solve this by calling npm run dev | grep name-of-task. This works but potentially includes false positives. Additionally, concurrently will not color the task name because it is not directly attached to the terminal.

gustavohenke commented 1 year ago

How does the existing --hide flag work for you?

amannn commented 1 year ago

I have a similar situation. I have two processes and would like to use --hide 1 --raw, so that only the output from the first process is displayed. Unfortunately, --raw seems to ignore any --hide argument.

Would it make sense to support this?

gustavohenke commented 11 months ago

Yes, but note that raw mode implies inheriting stdio, which means no control over the output.

https://github.com/open-cli-tools/concurrently/blob/a61ef39468c82b66ebb247a5a5e2cf479a0c4def/src/get-spawn-opts.ts#L42

It might be possible to change it to ignore instead of inherit to support your use case.

reknih commented 11 months ago

How does the existing --hide flag work for you?

It works I guess but I run many tasks, so it's much easier to list the task I want to see instead of every other task.

wottpal commented 3 weeks ago

Thumbs up for --hide 1 --raw. Did anyone manage to get this working (with colors)?

Update: Found a surprisingly simple solution:

concurrently \"command-1\" \"command-2 > /dev/null 2>&1\" --raw
gustavohenke commented 3 weeks ago

Hey @wottpal and @amannn, the --hide + --raw flag combo has been fixed by #486. It's not yet released.

gustavohenke commented 1 week ago

☝️ It's been released now. https://github.com/open-cli-tools/concurrently/releases/tag/v9.0.0