Add command name as an option

This commit is contained in:
Jakub Turek
2015-05-16 14:04:43 +02:00
parent 94d301f66f
commit 4e18ae1f8c
2 changed files with 66 additions and 9 deletions
+14 -1
View File
@@ -29,6 +29,7 @@ abstract class AbstractCommand
private $helpMessage;
private $usageExamples = [];
private $syntaxMessage;
private $name;
/**
* Runs the Command
@@ -57,6 +58,13 @@ abstract class AbstractCommand
return $this->config;
}
public function setName($name)
{
$this->name = $name;
return $this;
}
public function setHelpMessage($message)
{
$this->helpMessage = $message;
@@ -83,10 +91,15 @@ abstract class AbstractCommand
$indent = str_repeat(" ", 4);
$output = "";
if (!empty($this->name)) {
$output .= "\n";
$output .= "<cyan><bold>Command: </bold></cyan>";
$output .= $this->name;
}
if (!empty($this->helpMessage)) {
$output .= "\n";
$output .= "<cyan><bold>{$this->helpMessage}</bold></cyan>\n";
$output .= "<light_blue>{$this->helpMessage}</light_blue>\n";
}
if (!empty($this->syntaxMessage)) {