feat(occ): show current version with occ app:update command

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
This commit is contained in:
Maksim Sukharev 2026-02-05 12:07:30 +01:00 committed by Andy Scherzinger
parent 3f1b912782
commit 9fb2d5bffa

View file

@ -48,6 +48,12 @@ class Update extends Command {
InputOption::VALUE_NONE,
'show update(s) without updating'
)
->addOption(
'showcurrent',
null,
InputOption::VALUE_NONE,
'show currently installed version'
)
->addOption(
'allow-unstable',
null,
@ -60,6 +66,7 @@ class Update extends Command {
protected function execute(InputInterface $input, OutputInterface $output): int {
$singleAppId = $input->getArgument('app-id');
$updateFound = false;
$showOnly = $input->getOption('showonly') || $input->getOption('showcurrent');
if ($singleAppId) {
$apps = [$singleAppId];
@ -69,7 +76,7 @@ class Update extends Command {
$output->writeln($singleAppId . ' not installed');
return 1;
}
} elseif ($input->getOption('all') || $input->getOption('showonly')) {
} elseif ($input->getOption('all') || $showOnly) {
$apps = $this->manager->getAllAppsInAppsFolders();
} else {
$output->writeln('<error>Please specify an app to update or "--all" to update all updatable apps"</error>');
@ -81,9 +88,13 @@ class Update extends Command {
$newVersion = $this->installer->isUpdateAvailable($appId, $input->getOption('allow-unstable'));
if ($newVersion) {
$updateFound = true;
$output->writeln($appId . ' new version available: ' . $newVersion);
$message = $appId . ' new version available: ' . $newVersion;
if ($input->getOption('showcurrent')) {
$message .= ' (current version: ' . $this->manager->getAppVersion($appId) . ')';
}
$output->writeln($message);
if (!$input->getOption('showonly')) {
if (!$showOnly) {
try {
$result = $this->installer->updateAppstoreApp($appId, $input->getOption('allow-unstable'));
} catch (\Exception $e) {