summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/IRC/Application.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/IRC/Application.php b/src/IRC/Application.php
new file mode 100644
index 0000000..4bb6d71
--- /dev/null
+++ b/src/IRC/Application.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace FBeans\Blatask\IRC;
+
+use FBeans\BlaIRC\Command;
+use FBeans\BlaIRC\Application As BlaApplication;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Process\Process;
+
+class Application extends BlaApplication
+{
+ public function command(): Command
+ {
+ $command = new Command;
+ $command->setName('task:list');
+
+ // argument 0 is the command name
+ $command->addArgument(1);
+
+ $command->setExecuteCallback(
+ function (InputInterface $input, OutputInterface $output) {
+ $filter = $input->getArgument(1);
+
+ $process_argument = ["task", "list"];
+
+ if ($filter) {
+ $process_argument[] = $filter;
+ }
+
+ $process = new Process($process_argument);
+
+ $process->run();
+
+ if (!$process->isSuccessful()) {
+ $output->write($process->getErrorOutput());
+ return Command::SUCCESS;
+ }
+
+ $output->write($process->getOutput());
+ return Command::FAILURE;
+ }
+ );
+
+ return $command;
+ }
+}