[PR #571] [CLOSED] Add a --color flag to the CLI and disable colors for Pkl test #625

Closed
opened 2025-12-30 01:25:43 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/571
Author: @thomaspurchas
Created: 7/7/2024
Status: Closed

Base: error-coloringHead: error-coloring


📝 Commits (1)

  • 46907c7 Add a --color flag to the CLI and disable colors for Pkl test

📊 Changes

8 files changed (+34 additions, -6 deletions)

View changed files

📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/TestCommand.kt (+1 -1)
📝 pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliBaseOptions.kt (+1 -0)
📝 pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliCommand.kt (+17 -0)
📝 pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt (+10 -2)
📝 pkl-commons-test/src/main/kotlin/org/pkl/commons/test/InputOutputTestEngine.kt (+0 -1)
📝 pkl-core/src/test/kotlin/org/pkl/core/LanguageSnippetTestsEngine.kt (+1 -0)
📝 pkl-gradle/src/main/java/org/pkl/gradle/task/BasePklTask.java (+2 -1)
📝 pkl-gradle/src/main/java/org/pkl/gradle/task/ModulesTask.java (+2 -1)

📄 Description

The --colors flag makes it possible to forcefully disable colour output, and also forcefully enable it. We make use of this in the native Pkl test engines by passing --colors=never into the pkl commands, which ensures we get a predictable output.

Additionally the pkl test command also sets --colors=never to ensure that pkl test output isn't accidentially contaminated with ansi escape chars, which will break example based tests.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/571 **Author:** [@thomaspurchas](https://github.com/thomaspurchas) **Created:** 7/7/2024 **Status:** ❌ Closed **Base:** `error-coloring` ← **Head:** `error-coloring` --- ### 📝 Commits (1) - [`46907c7`](https://github.com/apple/pkl/commit/46907c774f0ebd98d47c6ac94b1c07f040ab9e19) Add a --color flag to the CLI and disable colors for Pkl test ### 📊 Changes **8 files changed** (+34 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/commands/TestCommand.kt` (+1 -1) 📝 `pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliBaseOptions.kt` (+1 -0) 📝 `pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliCommand.kt` (+17 -0) 📝 `pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt` (+10 -2) 📝 `pkl-commons-test/src/main/kotlin/org/pkl/commons/test/InputOutputTestEngine.kt` (+0 -1) 📝 `pkl-core/src/test/kotlin/org/pkl/core/LanguageSnippetTestsEngine.kt` (+1 -0) 📝 `pkl-gradle/src/main/java/org/pkl/gradle/task/BasePklTask.java` (+2 -1) 📝 `pkl-gradle/src/main/java/org/pkl/gradle/task/ModulesTask.java` (+2 -1) </details> ### 📄 Description The --colors flag makes it possible to forcefully disable colour output, and also forcefully enable it. We make use of this in the native Pkl test engines by passing --colors=never into the pkl commands, which ensures we get a predictable output. Additionally the pkl test command also sets --colors=never to ensure that pkl test output isn't accidentially contaminated with ansi escape chars, which will break example based tests. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:25:43 +01:00
adam closed this issue 2025-12-30 01:25:43 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#625