katmai

Well-Known Member
Mar 13, 2006
564
4
168
Brno, Czech Republic
hey guys so this is kinda an odd request. i know i sorted this problem a while ago but i totally forgot how to do it now.

i have this new centos7 server screencast.com/t/jA8z205a - where when running "composer" the display is all black and white, and i have this other server:

screencast.com/t/dZJI7eIHa - where the display is colored and the composer running commands output is colored.

i setup the second server too and i know i enabled something but i honest to god don't remember what i did to have composer colored display.

can someone give me a hint? ill be in your debt.
 

katmai

Well-Known Member
Mar 13, 2006
564
4
168
Brno, Czech Republic
the answer came to me after i posted this thread.

composer --ansi :)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463
Hello,

I'm happy to see you were able to find the answer to your question. Thank you for updating us with the outcome.
 

katmai

Well-Known Member
Mar 13, 2006
564
4
168
Brno, Czech Republic
I am still curious how you guys are doing it on cPanel though, because the way i did it was create a script that runs composer --ansi whenever i type "composer", however i see that on my cpanel box where there's composer, the colors show without me forcing --ansi :
- Removed -
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463
You can review Composer's installation file to see how they have it configured by default at:

getcomposer.org/installer at master · composer/getcomposer.org · GitHub

EX:

Code:
/**
 * Sets the USE_ANSI define for colorizing output
 *
 * @param array $argv Command-line arguments
 */
function setUseAnsi($argv)
{
    // --no-ansi wins over --ansi
    if (in_array('--no-ansi', $argv)) {
        define('USE_ANSI', false);
    } elseif (in_array('--ansi', $argv)) {
        define('USE_ANSI', true);
    } else {
        // On Windows, default to no ANSI, except in ANSICON and ConEmu.
        // Everywhere else, default to ANSI if stdout is a terminal.
        define(
            'USE_ANSI',
            (DIRECTORY_SEPARATOR == '\\')
                ? (false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'))
                : (function_exists('posix_isatty') && posix_isatty(1))
        );
    }
}

/**
Thank you.