setName('admin:update:code') ->addOption('update-version', null, Option::VALUE_REQUIRED, '按指定版本的规则更新现有代码') ->setDescription('the admin:update:code command'); } protected function execute(Input $input, Output $output) { // 指令输出 $update_version = $input->getOption('update-version'); if(is_null($update_version)){ $output->error('请指定更新的版本号'); return; } $update_service = new AdminUpdateCodeService(); $update_service->input = $input; $update_service->output = $output; $update_service->update($update_version); } }