You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add -NoColor switch parameter to control colored output in formatters (#18)
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
```powershell
# 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.
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to
start the survey.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: HeyItsGilbert <[email protected]>
Co-authored-by: Gilbert Sanchez <[email protected]>
Disables colored output in the formatter. When specified, the output will be
105
+
displayed without ANSI color codes.
106
+
107
+
```yaml
108
+
Type: SwitchParameter
109
+
Parameter Sets: (All)
110
+
Aliases:
111
+
112
+
Required: False
113
+
Position: Named
114
+
Default value: False
115
+
Accept pipeline input: False
116
+
Accept wildcard characters: False
117
+
```
118
+
103
119
### CommonParameters
104
120
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
0 commit comments