Execute a colorized command from a php script

后端 未结 2 1038
萌比男神i
萌比男神i 2021-01-11 12:03

I have a command, for example \'git diff\' that output a colorized result when I run it from the terminal.

Now, I want to call that command from a CLI php script and

2条回答
  •  耶瑟儿~
    2021-01-11 13:02

    In all likelihood the command you are running is checking to see if output is to a terminal and not colorizing it if it isn't. There is usually a way to force it, but that's going to be specific to the command itself; in the case of git diff, you can specify --color=always.

提交回复
热议问题