Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 15, 2025

Adds a -NoColor switch parameter to both Read-ChocoLog and Get-ChocoLogEntry functions to allow users to disable colored output in the formatter. This addresses user needs for plain text output in environments that don't support ANSI colors or when capturing output for logging systems.

Changes

  • Added -NoColor parameter to both public functions with proper documentation
  • Implemented module-level variable $script:ChocoLogNoColor to control formatter behavior
  • Updated formatter logic in ChocoLog.format.ps1xml to conditionally apply colors based on the variable
  • Fixed existing bug where undefined $bg variable was referenced in the original formatter
  • Bumped version from 1.0.1 to 1.1.0 to reflect new feature addition
  • Updated changelog with comprehensive details of the new functionality

Usage

# Default behavior (colored output) - unchanged
Read-ChocoLog
Get-ChocoLogEntry

# New functionality - disable colors
Read-ChocoLog -NoColor
Get-ChocoLogEntry -NoColor

Benefits

  • Backward Compatible: Default behavior remains unchanged (colored output)
  • Minimal Implementation: Uses existing PowerShell formatting infrastructure
  • Clean Design: Single module variable controls all formatting behavior
  • Proper Documentation: Includes help text and usage examples
  • Semantic Versioning: Minor version bump (1.1.0) reflects feature addition

The implementation allows users to customize their experience based on their terminal capabilities or output requirements while maintaining the enhanced visual experience for users who want colored output.

Fixes #10.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Contributor Author

Copilot AI commented Aug 15, 2025

@HeyItsGilbert 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI changed the title [WIP] Add Option for User to Turn on/off Coloring Add -NoColor switch parameter to control colored output in formatters Aug 16, 2025
Copilot AI requested a review from HeyItsGilbert August 16, 2025 00:09
@HeyItsGilbert HeyItsGilbert marked this pull request as ready for review August 16, 2025 00:12
@github-actions
Copy link

github-actions bot commented Aug 16, 2025

Test Results

0 tests   - 180   0 ✅  - 178   0s ⏱️ -6s
0 suites  -  12   0 💤 ±  0 
0 files    -   3   0 ❌  -   2 

Results for commit e91e2e9. ± Comparison against base commit 40a6e62.

♻️ This comment has been updated with latest results.

* Added multiple log files to the `tests/fixtures/folder` directory to enhance test coverage for the `Read-ChocoLog` function.
* Updated test setup to utilize these new log files, ensuring comprehensive testing of log parsing functionality.
* Refactored test cases for better clarity and accuracy in assertions.
@HeyItsGilbert
Copy link
Owner

@copilot Bump the minor version. Add a corresponding entry to the changelog.

@devactivity-app
Copy link

@HeyItsGilbert, ⭐3 XP earned, 🏆First Comment Added completed, 💪Level 8 achieved! [Details]

icon

Copy link
Contributor Author

Copilot AI commented Aug 16, 2025

@copilot Bump the minor version. Add a corresponding entry to the changelog.

Done! Bumped the minor version from 1.0.1 to 1.1.0 and added a comprehensive changelog entry for the -NoColor feature. The changes are in commit e91e2e9.


- `-NoColor` switch parameter to both `Read-ChocoLog` and `Get-ChocoLogEntry` functions
- Module-level variable `$script:ChocoLogNoColor` to control formatter behavior
- Colored output control in `ChocoLog.format.ps1xml` formatter

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [alex] reported by reviewdog 🐶
Be careful with Colored, it’s profane in some cases colored retext-profanities

@HeyItsGilbert HeyItsGilbert merged commit 44998fd into main Aug 16, 2025
3 of 6 checks passed
@HeyItsGilbert HeyItsGilbert deleted the copilot/fix-10 branch August 16, 2025 15:41
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.

Add Option for User to Turn on/off Coloring

2 participants