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

Add option to force colorized output #582

Open
scop opened this issue Nov 18, 2023 · 4 comments
Open

Add option to force colorized output #582

scop opened this issue Nov 18, 2023 · 4 comments
Labels
feature request A new lefthook feature description

Comments

@scop
Copy link
Contributor

scop commented Nov 18, 2023

⚡ Summary

An option to force colorized output would be nice. For example when running in GitHub Actions, the output is color capable but lefthook does not currently colorize there.

Value

More color and arguably readability in CI logs when lefthook is run there.

Behavior and configuration changes

Would probably be a good idea to deprecate the existing --no-colors flag and add a new --color={on,off,auto} to replace it.

@scop scop added the feature request A new lefthook feature description label Nov 18, 2023
@mrexox
Copy link
Member

mrexox commented Nov 20, 2023

Hey! There's a config option for that instead – colors. I don't think CLI option would be really useful, since lefthook is supposed to be executed implicitly by git hook.

Do you use lefthook in CI? Could you share your use case please?

@scop
Copy link
Contributor Author

scop commented Nov 20, 2023

I do use (well plan to use) lefthook in CI. Use case is: run exactly same things on developer systems and in CI. Same versions of everything, same config of everything. pre-commit works great for that, but has some other not so great parts that I'd hope lefthook will help fix.

Lefthook does not have builtin help for "same versions of everything" e.g. installing things which pre-commit does have (and that's its killer feature), but I have a hatching project at https://github.com/scop/wrun which will help with that in some cases. Some WIP dogfooding using lefthook at scop/wrun#49 -- this same thing runs both in CI and locally.

@scop
Copy link
Contributor Author

scop commented Nov 20, 2023

Regarding the config option, I guess I could make do with that and set up different config files for CI and local dev, but that's IMO really an antipattern I'd like to avoid having to do by default. In CI we need to invoke lefthook manually, and dropping e.g. --colors=on there would fit in great.

@scop
Copy link
Contributor Author

scop commented Nov 21, 2023

Regarding CI usage, here's pre-commit's related docs: https://pre-commit.com/#usage-in-continuous-integration

In my experience, this use case for pre-commit (and other hook managers) is not at all uncommon, there are lots of repositories e.g. here at GitHub that are set up to run the same hooks locally and in GH Actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A new lefthook feature description
Projects
None yet
Development

No branches or pull requests

2 participants