Example #1
0
 public function execute(array $args, array $options = array())
 {
     if (empty($args)) {
         $formater = new TextFormater(array('quote' => ' * '));
         $this->writeln('Available commands:', Colors::BLACK | Colors::BOLD);
         foreach ($this->console->getCommands() as $name => $fqdn) {
             if ($fqdn !== __CLASS__) {
                 $this->writeln($formater->format($name));
             }
         }
         $scriptName = basename($_SERVER['SCRIPT_FILENAME']);
         $this->writeln("Use './{$scriptName} help command' for more info");
     } else {
         $commandFQDN = $this->console->getCommand($args[0]);
         $help = Help::fromFQDN($commandFQDN, Utils::get($args, 1));
         $this->writeln($help);
     }
 }
Example #2
0
 /**
  * @param TextWriter $writer
  * @param array $formatOptions
  */
 public function __construct(TextWriter $writer, array $formatOptions = array())
 {
     parent::__construct($formatOptions);
     $this->textWriter = $writer;
 }
Example #3
0
 /**
  * Returns the text formated with the specified options
  * 
  * @param string $text
  * @param array $options
  * @return string
  */
 public static function apply($text, array $options = array())
 {
     $formater = new TextFormater($options);
     return $formater->format($text);
 }