@@ -132,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
132132 } elseif ($ tag = $ input ->getOption ('tag ' )) {
133133 $ options = array ('tag ' => $ tag );
134134 } elseif ($ name = $ input ->getArgument ('name ' )) {
135- $ name = $ this ->findProperServiceName ($ input , $ errorIo , $ object , $ name );
135+ $ name = $ this ->findProperServiceName ($ input , $ errorIo , $ object , $ name, $ input -> getOption ( ' show-hidden ' ) );
136136 $ options = array ('id ' => $ name );
137137 } else {
138138 $ options = array ();
@@ -208,13 +208,13 @@ protected function getContainerBuilder()
208208 return $ this ->containerBuilder = $ container ;
209209 }
210210
211- private function findProperServiceName (InputInterface $ input , SymfonyStyle $ io , ContainerBuilder $ builder , $ name )
211+ private function findProperServiceName (InputInterface $ input , SymfonyStyle $ io , ContainerBuilder $ builder , string $ name, bool $ showHidden )
212212 {
213213 if ($ builder ->has ($ name ) || !$ input ->isInteractive ()) {
214214 return $ name ;
215215 }
216216
217- $ matchingServices = $ this ->findServiceIdsContaining ($ builder , $ name );
217+ $ matchingServices = $ this ->findServiceIdsContaining ($ builder , $ name, $ showHidden );
218218 if (empty ($ matchingServices )) {
219219 throw new InvalidArgumentException (sprintf ('No services found that match "%s". ' , $ name ));
220220 }
@@ -224,11 +224,14 @@ private function findProperServiceName(InputInterface $input, SymfonyStyle $io,
224224 return $ io ->choice ('Select one of the following services to display its information ' , $ matchingServices , $ default );
225225 }
226226
227- private function findServiceIdsContaining (ContainerBuilder $ builder , $ name )
227+ private function findServiceIdsContaining (ContainerBuilder $ builder , string $ name, bool $ showHidden )
228228 {
229229 $ serviceIds = $ builder ->getServiceIds ();
230230 $ foundServiceIds = array ();
231231 foreach ($ serviceIds as $ serviceId ) {
232+ if (!$ showHidden && 0 === strpos ($ serviceId , '. ' )) {
233+ continue ;
234+ }
232235 if (false === stripos ($ serviceId , $ name )) {
233236 continue ;
234237 }
0 commit comments