-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Allow color.NoColor = false
to set via cli
#1566
Comments
Also see this related issue (Autoclosed): |
Bringing #1091 and this one together as feature request: The used color package does a good job in auto detecting whether the output supports ANSI coloring or not. Unfortunately for some use cases (mostly CI or other automation) this fails and needs manual override. Fortunately the color package already has this needed functionality as described in the color readme section for github-actions For the table format of trivy, it would be nice to have a trivy cli option --color with possible values true, false, and default auto. The default is current behavior, true or false set color.NoColor to the respective value. |
This would be very useful for simple use cases like a simple shell script that calls
|
This issue is stale because it has been labeled with inactivity. |
Fixes aquasecurity#1566 Add a new CLI option `--color` to enable or disable color output in Trivy. * **Flag Definition:** - Add `ColorFlag` in `pkg/flag/report_flags.go` to handle color settings. - Update `ReportFlagGroup` to include the new `ColorFlag`. * **Command Integration:** - Update `NewApp` function in `pkg/commands/app.go` to include the new `ColorFlag`. - Modify `cmd/trivy/main.go` to initialize the color settings based on the `--color` flag. * **Documentation:** - Update `docs/docs/references/configuration/cli/trivy_image.md` to include the new `--color` option. - Update `docs/docs/references/configuration/cli/trivy_filesystem.md` to include the new `--color` option. - Update `docs/docs/references/configuration/cli/trivy_config.md` to include the new `--color` option. - Update `docs/docs/references/configuration/cli/trivy.md` to include the new `--color` option. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/aquasecurity/trivy/issues/1566?shareId=XXXX-XXXX-XXXX-XXXX).
Reading https://github.com/fatih/color#github-actions it is possible to get colorful output also in ci environments by setting
color.NoColor = false
it would be nice if this can be set or forced via trivy cli option (like--no-colour=false
) for the table output.The text was updated successfully, but these errors were encountered: