Skip to content

Commit db740f4

Browse files
committed
✨ Use color output automatically if terminal supports it
1 parent 75540c3 commit db740f4

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ $ graphql-schema-diff --help
2525
--fail-on-dangerous-changes Exit with error on dangerous changes
2626
--fail-on-breaking-changes Exit with error on breaking changes
2727
--fail-on-all-changes Exit with error on all changes
28-
--use-colors Use colors for diff terminal output
2928
--create-html-output Creates an HTML file containing the diff
3029
--html-output-directory Directory where the HTML file should be stored (Default: './schemaDiff')
3130
--header, -H Header to send to all remote schema sources

src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const cli = meow(
1414
--fail-on-dangerous-changes Exit with error on dangerous changes
1515
--fail-on-breaking-changes \t Exit with error on breaking changes
1616
--fail-on-all-changes \t Exit with error on all changes
17-
--use-colors \t\t Use colors for diff terminal output
1817
--create-html-output \t Creates an HTML file containing the diff
1918
--html-output-directory \t Directory where the HTML file should be stored (Default: './schemaDiff')
2019
--header, -H \t\t Header to send to all remote schema sources
@@ -37,6 +36,7 @@ const cli = meow(
3736
failOnAllChanges: {
3837
type: "boolean",
3938
},
39+
// Deprecated: chalk.supportsColor should be used instead
4040
useColors: {
4141
type: "boolean",
4242
},
@@ -134,7 +134,7 @@ getDiff(leftSchemaLocation, rightSchemaLocation, {
134134
const hasBreakingChanges = result.breakingChanges.length !== 0;
135135
const hasDangerousChanges = result.dangerousChanges.length !== 0;
136136

137-
if (cli.flags.useColors) {
137+
if (cli.flags.useColors || chalk.supportsColor) {
138138
console.log(result.diff);
139139
} else {
140140
console.log(result.diffNoColor);

0 commit comments

Comments
 (0)