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

Color changes for wild cards #186

Closed
codeedog opened this issue Apr 18, 2019 · 2 comments · Fixed by #286
Closed

Color changes for wild cards #186

codeedog opened this issue Apr 18, 2019 · 2 comments · Fixed by #286
Labels

Comments

@codeedog
Copy link

Love this tool. When I tried the following (package.json has two start- scripts):

concurrently -c cyan,yellow "npm:start-*"

the output of both subtasks were displayed with cyan rather than the first being colored cyan and the second being colored yellow. Instructions indicate that when color count is less than command count, the last color listed is used. I suspect whatever does the color logging sees only the command line argument count (a single command) and doesn't realize its a wildcard command so doesn't look for the actual number of commands running. Or, the wildcard processing code doesn't update some command count global. Or, the wildcard processing code is somehow treated as only one process.

In any event, it'd be nice to have wildcard initiated commands individually colored.

My work around is to just explicitly start the commands by name and I still get the coloring. This works:

concurrently --c yellow,cyan npm:start-ng npm:start-express"

In addition, to explore some edge cases, I wrote a simple shell script that prints to the terminal and sleeps (see below). When I run it in with the wildcard, the wildcard logging is treated as a single process. Examples:

concurrently -k -c cyan,yellow,green "bash foo.sh" "npm:start-*"
concurrently -k -c cyan,yellow,green "npm:start-*" "bash foo.sh"

The first line outputs the shell logging in cyan and the two wildcards in yellow.
The second line outputs the two wildcards in cyan and the shell logging in yellow.

foo.sh

echo "hello"
sleep 1
echo "slept 1"
sleep 5
echo "slept 5"
sleep 60
echo "slept 60"
@daniloraisi
Copy link
Contributor

I was analyzing the code, and it seems that the problem is the way concurrently prefix colors.

As of this line:

lastColor = prefixColors[index] || lastColor;

It is considering only the first command to apply the color instead of applying each one when using a wildcard.

The command parser needs a way to apply prefix color when splitting npm wildcards.

@milahu, I can work on a PR to fix this.

@gustavohenke
Copy link
Member

Fix out in v6.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants