DocsListCommand.php 872 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
<?php

namespace AppBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

12
class DocsListCommand extends ContainerAwareCommand {
13

14 15 16 17 18 19 20 21 22 23 24 25
  protected function configure() {
    $this->setName('docs:list')->setDescription('List available books');
  }

  protected function execute(InputInterface $input, OutputInterface $output) {
    /** @var \AppBundle\BookLoader $books */
    $books = $this->getContainer()->get('book.loader');
    $table = new Table($output);
    $table->setHeaders(array('book', 'lang', 'repo', 'branch'));
    $table->addRows($books->findAsList());
    $table->render();
  }
26 27

}