示例#1
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|null|void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $lists = $this->rfcService->getLists([RfcService::IN_VOTING]);
     $rfcs = array_pop($lists);
     $table = new Table($output);
     $voteStyle = new TableStyle();
     $voteStyle->setCellRowFormat('<comment>%s</comment>');
     $rfcStyle = new TableStyle();
     $rfcStyle->setCellRowFormat('<info>%s</info>');
     foreach ($rfcs as $i => $rfcDetails) {
         $rfcCode = $rfcDetails[1];
         // Build RFC
         $rfc = $this->rfcService->getRfc($rfcCode);
         $table->addRow([$rfcDetails[0]], $rfcStyle);
         $table->addRow(new TableSeparator());
         foreach ($rfc->getVotes() as $title => $vote) {
             $table->addRow([$title], $voteStyle);
             array_shift($vote['counts']);
             foreach ($vote['counts'] as $key => $total) {
                 $table->addRow([$key, $total]);
             }
         }
         if ($rfcDetails !== end($rfcs)) {
             $table->addRow(new TableSeparator());
         }
     }
     $table->render();
 }
示例#2
0
 /**
  * {@inheritDoc}
  */
 protected function doExecute()
 {
     $table = new Table($this->output);
     $table->setHeaders(['Name', 'Description']);
     $style = new TableStyle();
     $style->setCellHeaderFormat('<fg=red>%s</fg=red>');
     $style->setCellRowFormat('<fg=blue>%s</fg=blue>');
     $style->setBorderFormat('<fg=yellow>%s</fg=yellow>');
     $table->setStyle($style);
     /** @type AbstractTask[] $services */
     $services = $this->container->get('bldr.registry.task')->findAll();
     foreach ($services as $service) {
         if ($service instanceof AbstractTask) {
             $service->configure();
         }
         $table->addRow([$service->getName(), $service->getDescription() !== '' ? $service->getDescription() : 'No Description']);
     }
     $table->render($this->output);
 }
示例#3
0
 /**
  * Execute Command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $sections = ['voting' => RfcService::IN_VOTING, 'discussion' => RfcService::DISCUSSION, 'draft' => RfcService::DRAFT, 'accepted' => RfcService::ACCEPTED, 'declined' => RfcService::DECLINED, 'withdrawn' => RfcService::WITHDRAWN, 'inactive' => RfcService::INACTIVE];
     $sections = array_intersect_key($sections, array_filter($input->getOptions()));
     if (count($sections) === 0 && !$input->getOption('all')) {
         $sections[] = RfcService::IN_VOTING;
     }
     $table = new Table($output);
     $titleStyle = new TableStyle();
     $titleStyle->setCellRowFormat('<comment>%s</comment>');
     $lists = $this->rfcService->getLists($sections);
     $table->setHeaders(['RFC', 'RFC Code']);
     foreach ($lists as $heading => $list) {
         $table->addRow([$heading], $titleStyle);
         $table->addRow(new TableSeparator());
         foreach ($list as $listing) {
             $table->addRow($listing);
         }
         if ($list !== end($lists)) {
             $table->addRow(new TableSeparator());
         }
     }
     $table->render();
 }
示例#4
0
 /**
  * {@inheritDoc}
  */
 protected function doExecute()
 {
     /** @type AbstractTask $service */
     $service = $this->container->get('bldr.registry.task')->findTaskByType($this->input->getArgument('task'));
     $this->output->writeln('');
     $this->output->writeln('<fg=green>Task Name</fg=green>: ' . $service->getName());
     if ($service->getDescription() !== null) {
         $this->output->writeln('<fg=green>Task Description</fg=green>: ' . $service->getDescription());
     }
     if ($service instanceof AbstractTask) {
         $this->output->writeln(['', '<fg=green>Options:</fg=green>']);
         $tableHelper = new Table($this->output);
         $style = new TableStyle();
         $style->setCellHeaderFormat('<fg=red>%s</fg=red>');
         $style->setCellRowFormat('<fg=blue>%s</fg=blue>');
         $style->setBorderFormat('<fg=yellow>%s</fg=yellow>');
         $tableHelper->setStyle($style);
         $tableHelper->setHeaders(['Option', 'Description', 'Required', "Default"]);
         foreach ($service->getParameterDefinition() as $option) {
             $tableHelper->addRow([$option['name'], $option['description'] !== '' ? $option['description'] : 'No Description', $option['required'] ? 'Yes' : 'No', json_encode($option['default'])]);
         }
         $tableHelper->render();
     }
 }