/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $paths = $input->getArgument('path'); if ($input->getOption('process')) { $output->writeln("Will scan and process things we find there."); } // Initialize the index, which is both the worker // and the interface to the database. $options = $this->getApplication()->options; $index = new Index($options); // Tell the index where to log to. // This also allows it access to the verbosity option. $index->setoutput($output); foreach ($paths as $path) { $index->indexFolder($path); } }
/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { // Initialize the index, which is both the worker // and the interface to the database. $options = $this->getApplication()->options; $index = new Index($options); // Tell the index where to log to. // This also allows it access to the verbosity option. $index->setoutput($output); if ($max_tasks = $input->getOption('max-tasks')) { $index->setOption('max-tasks', $max_tasks); } $max_tasks = $index->getOption('max-tasks'); // Add a progress bar, why not? $progress = new ProgressBar($output, $max_tasks); $index->setProgress($progress); $progress->start(); $index->runTasks(); $progress->finish(); $output->writeln(''); }