Skip to content

Conversation

@iggyvolz
Copy link
Contributor

Allows --no-color to be passed, which will prevent any color from being written to the terminal.

@lpinca
Copy link
Member

lpinca commented May 30, 2017

I think this commit a2ae4f5 was to remove colors when stdout is not a tty.

cc: @nwwells

@lpinca
Copy link
Member

lpinca commented May 30, 2017

oh nvm this is to always remove colors.

bin/wscat Outdated
this.clear();
color = color || Console.Colors.Default;
this.stdout.write(color + type + msg + Console.Colors.Default + '\n');
if(program.color) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we simplify this? Like

if (color === undefined) color = Console.Colors.Default;
if (!program.color) color = '';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@lpinca
Copy link
Member

lpinca commented May 30, 2017

SGTM.

@lpinca lpinca merged commit 69d83a6 into websockets:master May 30, 2017
@lpinca
Copy link
Member

lpinca commented May 30, 2017

Thank you.

@iggyvolz iggyvolz deleted the no-color branch May 30, 2017 18:14
@lotkao
Copy link
Contributor

lotkao commented Dec 3, 2017

This doesn't work - it just removes all coloring permanently.

Line 70 if (!program.color) color = '';
There is no program.color, so color is always cleared.

Line 137 .option('--no-color', 'Run without color')
This is the only time "no-color" is used, so the option is pointless as is.

I suggest the following:

Line 70 change to: if (program.nocolor) color = '';

Line 137 change to: .option('--nocolor', 'Run without color')
because having the dash in there brakes it.

This will have the desired effect of having no colors when calling wscat with --nocolor.

@lotkao lotkao mentioned this pull request Dec 3, 2017
@lotkao
Copy link
Contributor

lotkao commented Dec 4, 2017

I tested the master again, and --no-color is working. Please disregard my previous post. I was not aware that using --no-color would become color.

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.

4 participants