mirror of
https://github.com/hauke68/Magallanes.git
synced 2025-09-16 13:50:17 +02:00
Add console colours to command info output
This commit is contained in:
parent
4c519dd3bc
commit
94d301f66f
@ -86,20 +86,19 @@ abstract class AbstractCommand
|
|||||||
|
|
||||||
if (!empty($this->helpMessage)) {
|
if (!empty($this->helpMessage)) {
|
||||||
$output .= "\n";
|
$output .= "\n";
|
||||||
$output .= $this->helpMessage . "\n";
|
$output .= "<cyan><bold>{$this->helpMessage}</bold></cyan>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->syntaxMessage)) {
|
if (!empty($this->syntaxMessage)) {
|
||||||
$output .= "\n";
|
$output .= "\n";
|
||||||
$output .= "Syntax:\n";
|
$output .= "<light_gray><bold>Syntax:</bold></light_gray>\n";
|
||||||
$output .= $indent;
|
$output .= "$indent<light_green>{$this->syntaxMessage}</light_green>";
|
||||||
$output .= $this->syntaxMessage;
|
|
||||||
$output .= "\n";
|
$output .= "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->usageExamples)) {
|
if (!empty($this->usageExamples)) {
|
||||||
$output .= "\n";
|
$output .= "\n";
|
||||||
$output .= "Usage examples:\n";
|
$output .= "<light_gray><bold>Usage examples:</bold></light_gray>\n";
|
||||||
foreach ($this->usageExamples as $example) {
|
foreach ($this->usageExamples as $example) {
|
||||||
$snippet = $example[0];
|
$snippet = $example[0];
|
||||||
$description = $example[1];
|
$description = $example[1];
|
||||||
@ -110,7 +109,7 @@ abstract class AbstractCommand
|
|||||||
$output .= "\n$indent$indent";
|
$output .= "\n$indent$indent";
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= $snippet;
|
$output .= "<green>$snippet</green>";
|
||||||
$output .= "\n";
|
$output .= "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,16 +62,16 @@ class AbstractCommandTest extends BaseTest
|
|||||||
],
|
],
|
||||||
'syntax' => 'mage example [light]',
|
'syntax' => 'mage example [light]',
|
||||||
'output' => "\n"
|
'output' => "\n"
|
||||||
. "This command does everything you want to\n"
|
. "<cyan><bold>This command does everything you want to</bold></cyan>\n"
|
||||||
. "\n"
|
. "\n"
|
||||||
. "Syntax:\n"
|
. "<light_gray><bold>Syntax:</bold></light_gray>\n"
|
||||||
. " mage example [light]\n"
|
. " <light_green>mage example [light]</light_green>\n"
|
||||||
. "\n"
|
. "\n"
|
||||||
. "Usage examples:\n"
|
. "<light_gray><bold>Usage examples:</bold></light_gray>\n"
|
||||||
. " * Default command:\n"
|
. " * Default command:\n"
|
||||||
. " mage example\n"
|
. " <green>mage example</green>\n"
|
||||||
. " * Runs the command with lights:\n"
|
. " * Runs the command with lights:\n"
|
||||||
. " mage example light\n"
|
. " <green>mage example light</green>\n"
|
||||||
],
|
],
|
||||||
'no_help_message' => [
|
'no_help_message' => [
|
||||||
'helpMessage' => '',
|
'helpMessage' => '',
|
||||||
@ -87,24 +87,24 @@ class AbstractCommandTest extends BaseTest
|
|||||||
],
|
],
|
||||||
'syntax' => 'mage example [light]',
|
'syntax' => 'mage example [light]',
|
||||||
'output' => "\n"
|
'output' => "\n"
|
||||||
. "Syntax:\n"
|
. "<light_gray><bold>Syntax:</bold></light_gray>\n"
|
||||||
. " mage example [light]\n"
|
. " <light_green>mage example [light]</light_green>\n"
|
||||||
. "\n"
|
. "\n"
|
||||||
. "Usage examples:\n"
|
. "<light_gray><bold>Usage examples:</bold></light_gray>\n"
|
||||||
. " * Default command:\n"
|
. " * Default command:\n"
|
||||||
. " mage example\n"
|
. " <green>mage example</green>\n"
|
||||||
. " * Runs the command with lights:\n"
|
. " * Runs the command with lights:\n"
|
||||||
. " mage example light\n"
|
. " <green>mage example light</green>\n"
|
||||||
],
|
],
|
||||||
'no_examples' => [
|
'no_examples' => [
|
||||||
'helpMessage' => 'This command does everything you want to',
|
'helpMessage' => 'This command does everything you want to',
|
||||||
'examples' => [],
|
'examples' => [],
|
||||||
'syntax' => 'mage example [light]',
|
'syntax' => 'mage example [light]',
|
||||||
'output' => "\n"
|
'output' => "\n"
|
||||||
. "This command does everything you want to\n"
|
. "<cyan><bold>This command does everything you want to</bold></cyan>\n"
|
||||||
. "\n"
|
. "\n"
|
||||||
. "Syntax:\n"
|
. "<light_gray><bold>Syntax:</bold></light_gray>\n"
|
||||||
. " mage example [light]\n"
|
. " <light_green>mage example [light]</light_green>\n"
|
||||||
],
|
],
|
||||||
"no_syntax" => [
|
"no_syntax" => [
|
||||||
'helpMessage' => 'This command does everything you want to',
|
'helpMessage' => 'This command does everything you want to',
|
||||||
@ -120,13 +120,13 @@ class AbstractCommandTest extends BaseTest
|
|||||||
],
|
],
|
||||||
'syntax' => '',
|
'syntax' => '',
|
||||||
'output' => "\n"
|
'output' => "\n"
|
||||||
. "This command does everything you want to\n"
|
. "<cyan><bold>This command does everything you want to</bold></cyan>\n"
|
||||||
. "\n"
|
. "\n"
|
||||||
. "Usage examples:\n"
|
. "<light_gray><bold>Usage examples:</bold></light_gray>\n"
|
||||||
. " * Default command:\n"
|
. " * Default command:\n"
|
||||||
. " mage example\n"
|
. " <green>mage example</green>\n"
|
||||||
. " * Runs the command with lights:\n"
|
. " * Runs the command with lights:\n"
|
||||||
. " mage example light\n"
|
. " <green>mage example light</green>\n"
|
||||||
],
|
],
|
||||||
"stripping_colons" => [
|
"stripping_colons" => [
|
||||||
'helpMessage' => 'This command does everything you want to',
|
'helpMessage' => 'This command does everything you want to',
|
||||||
@ -142,23 +142,23 @@ class AbstractCommandTest extends BaseTest
|
|||||||
],
|
],
|
||||||
'syntax' => 'mage example [light]',
|
'syntax' => 'mage example [light]',
|
||||||
'output' => "\n"
|
'output' => "\n"
|
||||||
. "This command does everything you want to\n"
|
. "<cyan><bold>This command does everything you want to</bold></cyan>\n"
|
||||||
. "\n"
|
. "\n"
|
||||||
. "Syntax:\n"
|
. "<light_gray><bold>Syntax:</bold></light_gray>\n"
|
||||||
. " mage example [light]\n"
|
. " <light_green>mage example [light]</light_green>\n"
|
||||||
. "\n"
|
. "\n"
|
||||||
. "Usage examples:\n"
|
. "<light_gray><bold>Usage examples:</bold></light_gray>\n"
|
||||||
. " * Default command:\n"
|
. " * Default command:\n"
|
||||||
. " mage example\n"
|
. " <green>mage example</green>\n"
|
||||||
. " * Runs the command with lights:\n"
|
. " * Runs the command with lights:\n"
|
||||||
. " mage example light\n"
|
. " <green>mage example light</green>\n"
|
||||||
],
|
],
|
||||||
"only_help" => [
|
"only_help" => [
|
||||||
'helpMessage' => 'This command does everything you want to',
|
'helpMessage' => 'This command does everything you want to',
|
||||||
'examples' => [],
|
'examples' => [],
|
||||||
'syntax' => '',
|
'syntax' => '',
|
||||||
'output' => "\n"
|
'output' => "\n"
|
||||||
. "This command does everything you want to\n"
|
. "<cyan><bold>This command does everything you want to</bold></cyan>\n"
|
||||||
],
|
],
|
||||||
"only_examples" => [
|
"only_examples" => [
|
||||||
'helpMessage' => '',
|
'helpMessage' => '',
|
||||||
@ -174,19 +174,19 @@ class AbstractCommandTest extends BaseTest
|
|||||||
],
|
],
|
||||||
'syntax' => '',
|
'syntax' => '',
|
||||||
'output' => "\n"
|
'output' => "\n"
|
||||||
. "Usage examples:\n"
|
. "<light_gray><bold>Usage examples:</bold></light_gray>\n"
|
||||||
. " * Default command:\n"
|
. " * Default command:\n"
|
||||||
. " mage example\n"
|
. " <green>mage example</green>\n"
|
||||||
. " * Runs the command with lights:\n"
|
. " * Runs the command with lights:\n"
|
||||||
. " mage example light\n"
|
. " <green>mage example light</green>\n"
|
||||||
],
|
],
|
||||||
"only_syntax" => [
|
"only_syntax" => [
|
||||||
'helpMessage' => '',
|
'helpMessage' => '',
|
||||||
'examples' => [],
|
'examples' => [],
|
||||||
'syntax' => 'mage example [light]',
|
'syntax' => 'mage example [light]',
|
||||||
'output' => "\n"
|
'output' => "\n"
|
||||||
. "Syntax:\n"
|
. "<light_gray><bold>Syntax:</bold></light_gray>\n"
|
||||||
. " mage example [light]\n"
|
. " <light_green>mage example [light]</light_green>\n"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user