setName('menu') ->addOption('addon', 'a', Option::VALUE_OPTIONAL) ->setDescription('the menu command'); } protected function execute(Input $input, Output $output) { $addon = $input->getOption('addon'); if ($addon) { (new CoreMenuService())->refreshAddonMenu($addon); } else { (new InstallSystemService())->installMenu(); } // 指令输出 $output->writeln('menu refresh success'); } }