/** * Interactively select a file to download * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function interact(InputInterface $input, OutputInterface $output) { if (!$input->getArgument(self::ARGUMENT_NAME)) { $info = new Info(); $this->prepareDownloads($info->sendCommand('filter/version/*', $this->getAccountId(), $this->getAccessToken(), true)); $dialog = $this->getHelper('dialog'); $selectedMsg = 'You have selected: <info>%s</info>'; // Pick a type $types = array_keys($this->downloads); sort($types); $type = $dialog->select($this->output, '<question>Choose a type of download:</question>', $types, 0); $type = $types[$type]; $this->output->writeln(sprintf($selectedMsg, $type)); // Pick a version $versions = array_keys($this->downloads[$type]); sort($versions); $version = $dialog->select($this->output, '<question>Choose a version:</question>', $versions, 0); $version = $versions[$version]; $this->output->writeln(sprintf($selectedMsg, $version)); // Pick a file $files = $this->downloads[$type][$version]; sort($files); $file = $dialog->select($this->output, '<question>Choose a file:</question>', $files, 0); $file = $files[$file]; $this->output->writeln(sprintf($selectedMsg, $file)); $this->input->setArgument(self::ARGUMENT_NAME, $file); } }
/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $info = new Info(); $action = self::API_ACTION_FILES; $filters = $this->getFilters(); if ($filters) { $action = self::API_ACTION_FILTER; } return $this->render($info->sendCommand($action . $filters, $this->getAccountId(), $this->getAccessToken())); }
/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $info = new Info(); return $this->render($info->sendCommand(self::API_ACTION, $this->getAccountId(), $this->getAccessToken())); }