NielsdeBlaauw/php-doc-check

Add --ansi option to force table output when not running in a TTY

someonewithpc opened this issue · 1 comments

I looked through the code but wasn't able to figure out where the difference comes from, but when running this command from a git pre-commit hook, docker exec -it fails with the error the input device is not a TTY, and without the -it option, the output is not formatted into tables.

Tools like PHPStan and PHP-CS-fixer have a --ansi/--no-ansi option which would be helpful here.

I managed to work around this by running the command with < /dev/tty.

Specifically, the following:

make doc-check < /dev/tty
# where this make target runs bin/php-doc-check
# which runs:
docker exec -it container /path/vendor/bin/php-doc-check folders

Thanks for sharing this issue @someonewithpc

The table is rendered with the php-cli-tools dependency. Possibly updating to the latest version resolves this issue (partially). At least they have a somewhat related change in the latest release. wp-cli/php-cli-tools#145