44namespace kriskbx\gtt\Commands;
55
66use Gitlab\Client;
7- use kriskbx\gtt\Output\Csv;
8- use kriskbx\gtt\Output\Markdown;
7+ use kriskbx\gtt\Config\Config;
8+ use kriskbx\gtt\Output\CsvOutput;
9+ use kriskbx\gtt\Output\MarkdownOutput;
910use Symfony\Component\Console\Command\Command;
1011use Symfony\Component\Console\Input\ArrayInput;
1112use Symfony\Component\Console\Input\InputInterface;
@@ -16,7 +17,7 @@ class BaseCommand extends Command
1617{
1718 /**
1819 * Config array.
19- * @var array
20+ * @var Config
2021 */
2122 protected $config;
2223
@@ -31,16 +32,17 @@ class BaseCommand extends Command
3132 * @var array
3233 */
3334 protected $outputs = [
34- 'markdown' => Markdown::class
35+ 'markdown' => MarkdownOutput::class,
36+ 'csv' => CsvOutput::class
3537 ];
3638
3739 /**
3840 * ReportMonth constructor.
3941 *
4042 * @param Client $client
41- * @param array $config
43+ * @param Config $config
4244 */
43- public function __construct(Client $client, array $config)
45+ public function __construct(Client $client, Config $config)
4446 {
4547 $this->config = $config;
4648 $this->client = $client;
@@ -69,7 +71,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
6971 */
7072 protected function configure()
7173 {
72- $this->addOption('closed', null, InputOption::VALUE_REQUIRED, 'Include closed issues, defaults to false')
74+ $this->addOption('closed', null, InputOption::VALUE_REQUIRED,
75+ 'Include closed issues and merged merge requests, defaults to false')
7376 ->addOption('columns', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
7477 'Include the given columns in the report')
7578 ->addOption('date_format', null, InputOption::VALUE_REQUIRED, 'Date format')
@@ -80,10 +83,14 @@ protected function configure()
8083 null)
8184 ->addOption('file', null, InputOption::VALUE_OPTIONAL,
8285 'If output supports file-saving, specify the path to the file', null)
86+ ->addOption('include_by_labels', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
87+ 'Include only issues and merge requests by the given labels', null)
8388 ->addOption('include_labels', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
8489 'Include only the given labels in the result', null)
8590 ->addOption('exclude_labels', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
86- 'Exclude the given labels from the result', null);
91+ 'Exclude the given labels from the result', null)
92+ ->addOption('exclude_by_labels', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
93+ 'Exclude issues and merge requests by the given labels', null);;
8794 }
8895
8996 /**
@@ -118,9 +125,15 @@ protected function getDefaultArguments(InputInterface $input)
118125 if ($input->getOption('include_labels')) {
119126 $arguments['--include_labels'] = $input->getOption('include_labels');
120127 }
128+ if ($input->getOption('include_by_labels')) {
129+ $arguments['--include_by_labels'] = $input->getOption('include_by_labels');
130+ }
121131 if ($input->getOption('exclude_labels')) {
122132 $arguments['--exclude_labels'] = $input->getOption('exclude_labels');
123133 }
134+ if ($input->getOption('exclude_by_labels')) {
135+ $arguments['--exclude_by_labels'] = $input->getOption('exclude_by_labels');
136+ }
124137
125138 return $arguments;
126139 }
0 commit comments