diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-29 12:28:35 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-29 12:28:35 -0500 |
commit | e8fa25f9ca246fea085da46ea705a74b6de30d10 (patch) | |
tree | abf0fd767540e89ba5cfbbb7b6cabb64c4fcbb4e /app/Console/TaskExport.php | |
parent | d9879161281785c8e11fd074cec98f09df94dd46 (diff) |
Replace Core\Cli by Symfony\Console
Diffstat (limited to 'app/Console/TaskExport.php')
-rw-r--r-- | app/Console/TaskExport.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/app/Console/TaskExport.php b/app/Console/TaskExport.php new file mode 100644 index 00000000..b9f151fb --- /dev/null +++ b/app/Console/TaskExport.php @@ -0,0 +1,35 @@ +<?php + +namespace Console; + +use Core\Tool; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +class TaskExport extends Base +{ + protected function configure() + { + $this + ->setName('export:tasks') + ->setDescription('Tasks export (CSV)') + ->addArgument('project_id', InputArgument::REQUIRED, 'Project id') + ->addArgument('start_date', InputArgument::REQUIRED, 'Start date (YYYY-MM-DD)') + ->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)'); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $data = $this->taskExport->export( + $input->getArgument('project_id'), + $input->getArgument('start_date'), + $input->getArgument('end_date') + ); + + if (is_array($data)) { + Tool::csv($data); + } + } +} |