Enable ANSI Colors in commands [forcefully]

Submitted by hardevine - 10 years ago

Sometimes hasColorSupport() in Symfony\Console..StreamOutput returns false even if there is color support, to make it explicitly know we must call this method before output eg. in fire()

    /**
	 * Execute the console command.
	 *
	 * @return mixed
	 */
	public function fire()
	{
		// set color support explicitly
		$this->getOutput()->setDecorated(true);

		$this->error('Im Colored error');
		$this->info('Im colored info');
		$this->comment('Im colored comment');

	}