From 37594ccdf6581d669045e097114be37d221dba24 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Sun, 7 Jun 2020 03:09:35 +0100 Subject: First pass at making an IRC compatiable warapper to taskwarrior --- src/IRC/Application.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/IRC/Application.php (limited to 'src/IRC') 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 @@ +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; + } +} -- cgit v1.2.3