Esempio n. 1
0
 public function __construct(array $config = [])
 {
     $this->climate = new CLImate();
     self::$CI =& get_instance();
     $this->climate->setArgumentManager(new Console\Arguments\Manager());
     $this->climate->extend(Console\Extensions\Tab::class, 'tab');
     $this->climate->arguments->description('Yet another Codeigniter Starter Application');
     $this->add_global_commands($this);
     if (!empty($config['available_commands']) && is_array($config['available_commands'])) {
         $this->addCommands($config['available_commands']);
     }
 }
Esempio n. 2
0
 public function __construct(array $config = [])
 {
     $this->climate = new CLImate();
     self::$CI =& get_instance();
     $this->climate->addArt($config['art_directory']);
     $this->climate->setArgumentManager(new Arguments\Manager());
     $this->climate->extend(Extensions\Tab::class, 'tab');
     $this->climate->arguments->description('Yet another Codeigniter Starter Application');
     $this->climate->arguments->add(['help' => ['prefix' => 'h', 'longPrefix' => 'help', 'description' => static::lang('console_display_help'), 'noValue' => true]]);
     if (!empty($config['available_commands']) && is_array($config['available_commands'])) {
         $this->addCommands($config['available_commands']);
     }
 }
Esempio n. 3
0
 /**
  * @return int|null|void
  */
 protected function serve()
 {
     $this->options = $this->input->getOptions();
     $this->gpm = new GPM($this->options['force']);
     $this->displayGPMRelease();
     $this->data = $this->gpm->getRepository();
     $data = $this->filter($this->data);
     $climate = new CLImate();
     $climate->extend('Grav\\Console\\TerminalObjects\\Table');
     if (!$data) {
         $this->output->writeln('No data was found in the GPM repository stored locally.');
         $this->output->writeln('Please try clearing cache and running the <green>bin/gpm index -f</green> command again');
         $this->output->writeln('If this doesn\'t work try tweaking your GPM system settings.');
         $this->output->writeln('');
         $this->output->writeln('For more help go to:');
         $this->output->writeln(' -> <yellow>https://learn.getgrav.org/troubleshooting/common-problems#cannot-connect-to-the-gpm</yellow>');
         die;
     }
     foreach ($data as $type => $packages) {
         $this->output->writeln("<green>" . strtoupper($type) . "</green> [ " . count($packages) . " ]");
         $packages = $this->sort($packages);
         if (!empty($packages)) {
             $table = [];
             $index = 0;
             foreach ($packages as $slug => $package) {
                 $row = ['Count' => $index++ + 1, 'Name' => "<cyan>" . Utils::truncate($package->name, 20, false, ' ', '...') . "</cyan> ", 'Slug' => $slug, 'Version' => $this->version($package), 'Installed' => $this->installed($package)];
                 $table[] = $row;
             }
             $climate->table($table);
         }
         $this->output->writeln('');
     }
     $this->output->writeln('You can either get more informations about a package by typing:');
     $this->output->writeln('    <green>' . $this->argv . ' info <cyan><package></cyan></green>');
     $this->output->writeln('');
     $this->output->writeln('Or you can install a package by typing:');
     $this->output->writeln('    <green>' . $this->argv . ' install <cyan><package></cyan></green>');
     $this->output->writeln('');
 }