Skip to content
Permalink
Browse files

Fix: Clarify color option (fixes #5928) (#5974)

  • Loading branch information...
meeber authored and nzakas committed Apr 28, 2016
1 parent e7e6581 commit 577757d0bdbce9ddf913d4e6e54adfeef9069d02
Showing with 14 additions and 7 deletions.
  1. +5 −4 docs/user-guide/command-line-interface.md
  2. +2 −2 lib/options.js
  3. +7 −1 tests/lib/options.js
@@ -66,7 +66,7 @@ Handling warnings:
Output:
-o, --output-file path::String Specify file to write report to
-f, --format String Use a specific output format - default: stylish
--no-color Disable color in piped output
--color, --no-color Force enabling/disabling of color
Miscellaneous:
--init Run config initialization wizard - default: false
@@ -323,12 +323,13 @@ When specified, the given format is output to the console. If you'd like to save
This saves the output into the `results.txt` file.
#### `--no-color`
#### `--color`, `--no-color`
Disable color in piped output.
This option forces the enabling/disabling of colorized output. You can use this to override the default behavior, which is to enable colorized output unless no TTY is detected, such as when when piping `eslint` through `cat` or `less`.
Example:
Examples:
eslint --color file.js | cat
eslint --no-color file.js
### Miscellaneous
@@ -173,8 +173,8 @@ module.exports = optionator({
{
option: "color",
type: "Boolean",
default: "true",
description: "Disable color in piped output"
alias: "no-color",
description: "Force enabling/disabling of color"
},
{
heading: "Miscellaneous"
@@ -190,11 +190,17 @@ describe("options", function() {
});

describe("--color", function() {
it("should return true for .color when passed", function() {
it("should return true for .color when passed --color", function() {
var currentOptions = options.parse("--color");

assert.isTrue(currentOptions.color);
});

it("should return false for .color when passed --no-color", function() {
var currentOptions = options.parse("--no-color");

assert.isFalse(currentOptions.color);
});
});

describe("--stdin", function() {

0 comments on commit 577757d

Please sign in to comment.
You can’t perform that action at this time.