19
19
use Symfony \Component \Console \Exception \RuntimeException ;
20
20
use Symfony \Component \Console \Input \InputArgument ;
21
21
use Symfony \Component \Console \Input \InputInterface ;
22
+ use Symfony \Component \Console \Input \InputOption ;
22
23
use Symfony \Component \Console \Output \OutputInterface ;
23
24
use Symfony \Flex \Configurator ;
24
25
use Symfony \Flex \Downloader ;
@@ -57,6 +58,7 @@ protected function configure()
57
58
->setAliases (['recipes:update ' ])
58
59
->setDescription ('Updates an already-installed recipe to the latest version. ' )
59
60
->addArgument ('package ' , InputArgument::OPTIONAL , 'Recipe that should be updated. ' )
61
+ ->addOption ('next ' , null , InputOption::VALUE_NONE , 'Update recipe of next outdated package. ' )
60
62
;
61
63
}
62
64
@@ -81,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
81
83
$ packageName = $ input ->getArgument ('package ' );
82
84
$ symfonyLock = $ this ->flex ->getLock ();
83
85
if (!$ packageName ) {
84
- $ packageName = $ this ->askForPackage ($ io , $ symfonyLock );
86
+ $ packageName = $ this ->getNextOrAskForPackage ($ io , $ symfonyLock, $ input -> getOption ( ' next ' ) );
85
87
86
88
if (null === $ packageName ) {
87
89
$ io ->writeError ('All packages appear to be up-to-date! ' );
@@ -353,7 +355,7 @@ private function generateChangelog(Recipe $originalRecipe): ?array
353
355
return $ lines ;
354
356
}
355
357
356
- private function askForPackage (IOInterface $ io , Lock $ symfonyLock ): ?string
358
+ private function getNextOrAskForPackage (IOInterface $ io , Lock $ symfonyLock, bool $ next = false ): ?string
357
359
{
358
360
$ installedRepo = $ this ->getComposer ()->getRepositoryManager ()->getLocalRepository ();
359
361
@@ -373,6 +375,10 @@ private function askForPackage(IOInterface $io, Lock $symfonyLock): ?string
373
375
$ lockRef = $ symfonyLock ->get ($ name )['recipe ' ]['ref ' ] ?? null ;
374
376
375
377
if (null !== $ lockRef && $ recipe ->getRef () !== $ lockRef && !$ recipe ->isAuto ()) {
378
+ if ($ next ) {
379
+ return $ name ;
380
+ }
381
+
376
382
$ outdatedRecipes [] = $ name ;
377
383
}
378
384
}
0 commit comments