Skip to content

HelpProvider renders some formatting markup even with NO_COLOR #1583

@kzu

Description

@kzu

To Reproduce

dotnet tool update -g dotnet-trx
$env:NO_COLOR=1
trx --help

Raw output:

USAGE:
    trx [OPTIONS]

OPTIONS:
                          DEFAULT                                               
    -h, --help                       Prints help information                    
    -p, --path                       Optional base directory for *.trx files    
                                     discovery. Defaults to current directory   
    -o, --output                     Include test output                        
    -r, --recursive       �[1mTrue�[0m       Recursively search for *.trx files         
        --skipped         �[1mTrue�[0m       Include skipped tests                      
        --no-exit-code               Do not return a -1 exit code on test       
                                     failures                                   
        --version                    Show version information                   
        --gh-comment      �[1mTrue�[0m       Report as GitHub PR comment                
        --gh-summary      �[1mTrue�[0m       Report as GitHub step summary              

Expected behavior
Renders text only, with no bold or any other styles applied.

Screenshots
Default values have bold style applied:

image

The importance of the issue is that it prevents having an automated way to self-document a CLI tool via the package readme, automatically updated after compile with up-to-date usage info, as shown in https://www.cazzulino.com/auto-doc-cli.html

Metadata

Metadata

Assignees

Labels

area-CLICommand-Line InterfacebugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions