Skip to content

uvu --no-color has no effect #225

@kizdolf

Description

@kizdolf

The cli arguments defines -c, --color Print colorized output (default true), allowing the option --no-color to disable output colorization.

But using it has no effect.

This is due to two things:

option is never checked for false

The option set process.env.FORCE_COLOR = '1' when true (the default) but is never set to something else.
See: https://github.com/lukeed/uvu/blob/master/bin.js#L22
Since the default is true I propose

if (opts.color) process.env.FORCE_COLOR = '1';
else process.env.FORCE_COLOR = '0';

process.env.FORCE_COLOR is never checked.

colorization is done using kleur in https://github.com/lukeed/uvu/blob/master/src/diff.js
but it does not check for process.env.FORCE_COLOR

kleur has a enabled option, which could be usefull:

if(process.env.FORCE_COLOR === '0') kleur.enabled = false

I've open #226 to fix this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions