chalk/supports-color

Make flag sniffing optional #40

bolinfest posted onGitHub

Although the heuristics for inspecting process.argv via hasFlag() are pretty reasonable, they are by no means foolproof and can lead to false positives and negatives. It would be nice if it were possible to use the functionality of supportLevel() without any of the hasFlag() logic. I believe the remaining logic would be a function of:

  • process.env.CI
  • process.env.TEAMCITY_VERSION
  • process.env. COLORTERM
  • process.env.TERM
  • process.stdout
  • process.platform

It would be even more flexible if it were possible to pass in the process object so that it could be mocked and/or used from another process.


@issuehunt has funded $40.00 to this issue.


posted by issuehunt-app[bot] over 5 years ago

Since chalk is the primary consumer of this library, how would that look API-wise to have two versions for CLI flag checking?

posted by Qix- over 5 years ago

@sindresorhus has rewarded $36.00 to @qix-. See it on IssueHunt

  • :moneybag: Total deposit: $40.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $4.00
posted by issuehunt-app[bot] over 4 years ago

Fund this Issue

$40.00
Rewarded

Rewarded pull request

Recent activities

qix- was rewarded by sindresorhus for chalk/supports-color# 40
over 4 years ago
sindresorhus submitted an output to  chalk/ supports-color# 40
over 4 years ago