Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling colors #118

Merged
merged 10 commits into from
Dec 1, 2024
Merged

Conversation

kodie
Copy link
Contributor

@kodie kodie commented Nov 28, 2024

Just a tiny implementation that allows us to disable colors:

$command = new Ahc\Cli\Input\Command('test', 'My Test Command');

$command
  ->option('-n --no-colors', 'Disables terminal colors')
  ->parse(['thisfile.php', '--no-colors']);

if (!$this->colors) {
  Ahc\Cli\Output\Color::$enabled = false;
}

README.md Show resolved Hide resolved
@adhocore
Copy link
Owner

adhocore commented Dec 1, 2024

how does it play with html like color of this pkg? eg <boldRed>text</end><eol> should output just "text\n"

basically there are multiple ways to style/print colors, all those must output no color when disabled or env set

@kodie
Copy link
Contributor Author

kodie commented Dec 1, 2024

how does it play with html like color of this pkg? eg <boldRed>text</end><eol> should output just "text\n"

basically there are multiple ways to style/print colors, all those must output no color when disabled or env set

Every different way of styling/printing does so by using the line function as far as I could tell and from my tests that seem to be true. <boldRed>text</end><eol> works as you would expect as does the help screen.

@adhocore
Copy link
Owner

adhocore commented Dec 1, 2024

cool, thanks 👍

@adhocore adhocore merged commit cd0152f into adhocore:main Dec 1, 2024
6 checks passed
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.

2 participants