/**
  * Executes the current command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return int|null
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $headers = ['ID', 'Name', 'Status', 'IP', 'Region', 'Price Hourly'];
     $data = $this->provider->report();
     // Table expects an array of arrays, so we convert objects to arrays
     foreach ($data as &$object) {
         $object = (array) $object;
     }
     (new Table($output))->setHeaders($headers)->setRows($data)->render();
 }
Example #2
0
 /**
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  */
 private function waitUntilDropletsAreActive(OutputInterface $output)
 {
     $ready = false;
     while (!$ready) {
         $output->write('.');
         sleep(2);
         $droplets = $this->provider->report();
         foreach ($droplets as $droplet) {
             if ($droplet->status === 'active') {
                 $ready = true;
                 Droplet::save($droplets);
             }
         }
     }
     $output->writeln('.');
 }
Example #3
0
 /**
  * Executes the current command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return null|int
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->provider->down();
     Droplet::delete();
     $output->writeln('<info>The instances are now being terminated...</info>');
 }