setDescription("custom description | 自定义命令的描述字段");
$this->addOption("failure", null, null, "以错误码为1返回结果");
// ...
}
protected function execute(InputInterface $input, OutputInterface $output) {
if ($input->getOption("failure")) {
$output->writeln("Hello error! I am wrong message.");
return Command::FAILURE;
} else {
$output->writeln("Hello world! I am successful message.");
return Command::SUCCESS;
}
}
}