Commit a3af271e by Paul Klimov

Color output added to `yii\console\MessageController` and `yii\console\AssetController`

parent 86328823
...@@ -10,6 +10,7 @@ namespace yii\console\controllers; ...@@ -10,6 +10,7 @@ namespace yii\console\controllers;
use Yii; use Yii;
use yii\console\Exception; use yii\console\Exception;
use yii\console\Controller; use yii\console\Controller;
use yii\helpers\Console;
use yii\helpers\VarDumper; use yii\helpers\VarDumper;
/** /**
...@@ -423,7 +424,7 @@ EOD; ...@@ -423,7 +424,7 @@ EOD;
if (!file_put_contents($bundleFile, $bundleFileContent)) { if (!file_put_contents($bundleFile, $bundleFileContent)) {
throw new Exception("Unable to write output bundle configuration at '{$bundleFile}'."); throw new Exception("Unable to write output bundle configuration at '{$bundleFile}'.");
} }
$this->stdout("Output bundle configuration created at '{$bundleFile}'.\n"); $this->stdout("Output bundle configuration created at '{$bundleFile}'.\n", Console::FG_GREEN);
} }
/** /**
...@@ -656,7 +657,7 @@ EOD; ...@@ -656,7 +657,7 @@ EOD;
if (!file_put_contents($configFile, $template)) { if (!file_put_contents($configFile, $template)) {
throw new Exception("Unable to write template file '{$configFile}'."); throw new Exception("Unable to write template file '{$configFile}'.");
} else { } else {
$this->stdout("Configuration file template created at '{$configFile}'.\n\n"); $this->stdout("Configuration file template created at '{$configFile}'.\n\n", Console::FG_GREEN);
return self::EXIT_CODE_NORMAL; return self::EXIT_CODE_NORMAL;
} }
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace yii\console\controllers; namespace yii\console\controllers;
use Yii; use Yii;
use yii\base\ErrorException;
use yii\console\Controller; use yii\console\Controller;
use yii\console\Exception; use yii\console\Exception;
use yii\helpers\Console; use yii\helpers\Console;
...@@ -64,7 +63,7 @@ class MessageController extends Controller ...@@ -64,7 +63,7 @@ class MessageController extends Controller
} }
} }
copy(Yii::getAlias('@yii/views/messageConfig.php'), $filePath); copy(Yii::getAlias('@yii/views/messageConfig.php'), $filePath);
$this->stdout("Configuration file template created at '{$filePath}'.\n\n"); $this->stdout("Configuration file template created at '{$filePath}'.\n\n", Console::FG_GREEN);
return self::EXIT_CODE_NORMAL; return self::EXIT_CODE_NORMAL;
} }
...@@ -382,7 +381,7 @@ class MessageController extends Controller ...@@ -382,7 +381,7 @@ class MessageController extends Controller
sort($messages); sort($messages);
ksort($existingMessages); ksort($existingMessages);
if (array_keys($existingMessages) == $messages) { if (array_keys($existingMessages) == $messages) {
$this->stdout("Nothing new in \"$category\" category... Nothing to save.\n\n"); $this->stdout("Nothing new in \"$category\" category... Nothing to save.\n\n", Console::FG_GREEN);
return; return;
} }
$merged = []; $merged = [];
...@@ -452,7 +451,7 @@ return $array; ...@@ -452,7 +451,7 @@ return $array;
EOD; EOD;
file_put_contents($fileName, $content); file_put_contents($fileName, $content);
$this->stdout("Saved.\n\n"); $this->stdout("Translation saved.\n\n", Console::FG_GREEN);
} }
/** /**
...@@ -545,9 +544,9 @@ EOD; ...@@ -545,9 +544,9 @@ EOD;
} }
if ($hasSomethingToWrite) { if ($hasSomethingToWrite) {
$poFile->save($file, $merged); $poFile->save($file, $merged);
$this->stdout("Saved.\n"); $this->stdout("Translation saved.\n", Console::FG_GREEN);
} else { } else {
$this->stdout("Nothing to save.\n"); $this->stdout("Nothing to save.\n", Console::FG_GREEN);
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment