/** * Retrieves and prints a specified Jira ticket * @param InputInterface $input The console input object * @param OutputInterface $output The console output object */ protected function execute(InputInterface $input, OutputInterface $output) { $this->connect($input->getOption('url'), $input->getOption('auth')); $result = Issue::getInstance()->get($input->getArgument('issue-key')); if ($result === null || !empty($result->errors)) { $output->writeln(sprintf('<error>Error retrieving ticket `%s`: %s</error>', $input->getArgument('issue-key'), implode((array) $result->errors, PHP_EOL))); } else { $this->prettyPrintTicket($result, $output); } }
/** * Creates the Jira ticket and outputs the issue-key * @param InputInterface $input The console input object * @param OutputInterface $output The console output object */ protected function execute(InputInterface $input, OutputInterface $output) { $type = $input->getOption('type'); $this->connect($input->getOption('url'), $input->getOption('auth')); $custom = array_merge(array('priority' => array('name' => $input->getOption('priority'))), $this->getCustomOptionValues($input)); $result = Issue::getInstance()->simpleCreate($input->getArgument('project'), $input->getArgument('title'), $input->getArgument('description'), !empty($type) ? $type : 'Bug', array(), $custom); if ($result === null || !empty($result->errors)) { $output->writeln(sprintf('<error>Error creating ticket: %s</error>', implode((array) $result->errors, PHP_EOL))); } else { $output->writeln('Ticket created: <info>' . $result->key . '</info>' . PHP_EOL . 'URL: <info>' . $this->auth->getApiBaseUrl() . '/browse/' . $result->key . '</info>'); } }