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; } $array_output = explode("\n", $process->getOutput()); $output->writeLn($array_output[count($array_output) - 2]); return Command::FAILURE; } ); return [$command]; } }