File tree Expand file tree Collapse file tree 2 files changed +38
-38
lines changed Expand file tree Collapse file tree 2 files changed +38
-38
lines changed Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ protected function processCliCommand()
271
271
272
272
if (empty ($ args )) {
273
273
// No options set.
274
- $ this ->showColored = HelpTextFormatter:: isColorSupported ();
274
+ $ this ->showColored = $ this -> isColorSupported ();
275
275
276
276
return ;
277
277
}
@@ -283,7 +283,7 @@ protected function processCliCommand()
283
283
} elseif (isset ($ argsFlipped ['--colors ' ])) {
284
284
$ this ->showColored = true ;
285
285
} else {
286
- $ this ->showColored = HelpTextFormatter:: isColorSupported ();
286
+ $ this ->showColored = $ this -> isColorSupported ();
287
287
}
288
288
289
289
if (isset ($ argsFlipped ['-h ' ])
@@ -360,6 +360,41 @@ static function ($subdir) {
360
360
}
361
361
}
362
362
363
+ /**
364
+ * Detect whether or not the CLI supports colored output.
365
+ *
366
+ * @codeCoverageIgnore
367
+ *
368
+ * @return bool
369
+ */
370
+ protected function isColorSupported ()
371
+ {
372
+ // Windows.
373
+ if (\DIRECTORY_SEPARATOR === '\\' ) {
374
+ if (\getenv ('ANSICON ' ) !== false || \getenv ('ConEmuANSI ' ) === 'ON ' ) {
375
+ return true ;
376
+ }
377
+
378
+ if (\function_exists ('sapi_windows_vt100_support ' )) {
379
+ // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound
380
+ return @\sapi_windows_vt100_support (\STDOUT );
381
+ }
382
+
383
+ return false ;
384
+ }
385
+
386
+ if (\getenv ('GITHUB_ACTIONS ' )) {
387
+ return true ;
388
+ }
389
+
390
+ // Linux/MacOS.
391
+ if (\function_exists ('posix_isatty ' )) {
392
+ return @\posix_isatty (\STDOUT );
393
+ }
394
+
395
+ return false ;
396
+ }
397
+
363
398
/**
364
399
* Retrieve the version number of this script.
365
400
*
Original file line number Diff line number Diff line change 11
11
namespace PHPCSDevTools \Scripts \Utils ;
12
12
13
13
/**
14
- * Helper class for formatting help text and detecting color support .
14
+ * Helper class for formatting help text.
15
15
*
16
16
* ---------------------------------------------------------------------------------------------
17
17
* This class is not part of the public API. Backward compatibility is not guaranteed.
@@ -99,39 +99,4 @@ public static function format(array $helpTexts, $showColored)
99
99
100
100
return $ output ;
101
101
}
102
-
103
- /**
104
- * Detect whether or not the CLI supports colored output.
105
- *
106
- * @codeCoverageIgnore
107
- *
108
- * @return bool
109
- */
110
- public static function isColorSupported ()
111
- {
112
- // Windows.
113
- if (\DIRECTORY_SEPARATOR === '\\' ) {
114
- if (\getenv ('ANSICON ' ) !== false || \getenv ('ConEmuANSI ' ) === 'ON ' ) {
115
- return true ;
116
- }
117
-
118
- if (\function_exists ('sapi_windows_vt100_support ' )) {
119
- // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound
120
- return @\sapi_windows_vt100_support (\STDOUT );
121
- }
122
-
123
- return false ;
124
- }
125
-
126
- if (\getenv ('GITHUB_ACTIONS ' )) {
127
- return true ;
128
- }
129
-
130
- // Linux/MacOS.
131
- if (\function_exists ('posix_isatty ' )) {
132
- return @\posix_isatty (\STDOUT );
133
- }
134
-
135
- return false ;
136
- }
137
102
}
You can’t perform that action at this time.
0 commit comments