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

Is it possible to write the command you are executing using a color that distinguishes it from the rest of the output? #1186

Closed
frederikhors opened this issue May 15, 2022 · 8 comments · Fixed by #1670

Comments

@frederikhors
Copy link

It would be nice to have a way to distinguish the command from the output of the same when there are so many one after the other.

Is it possible to write the command you are executing using a color that distinguishes it from the rest of the output?

@casey
Copy link
Owner

casey commented May 16, 2022

Commands are echoed in bold, but that doesn't stand out a ton, and I can see how they would get lost in other output.

I wouldn't be opposed to a setting that changed the highlight color, e.g.:

set highlight := blue

foo:
  echo foo

@frederikhors
Copy link
Author

Yes, please. On Windows 10 all lines are the same, bold doesn't work.

@frederikhors
Copy link
Author

frederikhors commented May 16, 2022

It would be amazing to have something like {{blue}}{{custom_variable}}{{/blue}} too.

@casey
Copy link
Owner

casey commented May 17, 2022

Yes, please. On Windows 10 all lines are the same, bold doesn't work.

Ah, I didn't know that. If you do just -v RECIPE on Windows, does it print out ===> Running recipe RECIPE… in cyan? I want to make sure that colors aren't just generally broken on Windows.

@frederikhors
Copy link
Author

frederikhors commented May 17, 2022

Yep, the cyan works. The bold not.

@hustcer
Copy link
Contributor

hustcer commented May 17, 2022

It's quite easy to do it in nushell with just, here is a example: https://github.com/hustcer/setup-nu/blob/main/Justfile#L44
you can use (ansi xx) to set colors:
ansi g for green
ansi gb for green and bold, etc.

@frederikhors
Copy link
Author

OK. Thank you. But this is impossible for me because:

  1. each team member should not be forced to install a new shell;
  2. we'll use justfile for CI too; this means native shell only.

@avi-cenna
Copy link
Contributor

It's quite easy to do it in nushell with just, here is a example: https://github.com/hustcer/setup-nu/blob/main/Justfile#L44 you can use (ansi xx) to set colors: ansi g for green ansi gb for green and bold, etc.

This is nice, and I love nushell, but this requires you to explicitly define the colored print messages.

I think rust has some libraries to facilitate colored printing. I'm still a newbie at rust, but maybe I'll try my hand at this issue.

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

Successfully merging a pull request may close this issue.

4 participants