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

fix: Add --color flag to Trivy CLI #8250

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anupamme
Copy link

@anupamme anupamme commented Jan 17, 2025

Fixes #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.

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).
@anupamme anupamme requested a review from knqyf263 as a code owner January 17, 2025 07:53
@CLAassistant
Copy link

CLAassistant commented Jan 17, 2025

CLA assistant check
All committers have signed the CLA.

@anupamme anupamme changed the title Add --color flag to Trivy CLI fix: Add --color flag to Trivy CLI Jan 17, 2025
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 this pull request may close these issues.

Allow color.NoColor = false to set via cli
2 participants