@@ -132,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
132
132
} elseif ($ tag = $ input ->getOption ('tag ' )) {
133
133
$ options = array ('tag ' => $ tag );
134
134
} 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 ' ) );
136
136
$ options = array ('id ' => $ name );
137
137
} else {
138
138
$ options = array ();
@@ -208,13 +208,13 @@ protected function getContainerBuilder()
208
208
return $ this ->containerBuilder = $ container ;
209
209
}
210
210
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 )
212
212
{
213
213
if ($ builder ->has ($ name ) || !$ input ->isInteractive ()) {
214
214
return $ name ;
215
215
}
216
216
217
- $ matchingServices = $ this ->findServiceIdsContaining ($ builder , $ name );
217
+ $ matchingServices = $ this ->findServiceIdsContaining ($ builder , $ name, $ showHidden );
218
218
if (empty ($ matchingServices )) {
219
219
throw new InvalidArgumentException (sprintf ('No services found that match "%s". ' , $ name ));
220
220
}
@@ -224,11 +224,14 @@ private function findProperServiceName(InputInterface $input, SymfonyStyle $io,
224
224
return $ io ->choice ('Select one of the following services to display its information ' , $ matchingServices , $ default );
225
225
}
226
226
227
- private function findServiceIdsContaining (ContainerBuilder $ builder , $ name )
227
+ private function findServiceIdsContaining (ContainerBuilder $ builder , string $ name, bool $ showHidden )
228
228
{
229
229
$ serviceIds = $ builder ->getServiceIds ();
230
230
$ foundServiceIds = array ();
231
231
foreach ($ serviceIds as $ serviceId ) {
232
+ if (!$ showHidden && 0 === strpos ($ serviceId , '. ' )) {
233
+ continue ;
234
+ }
232
235
if (false === stripos ($ serviceId , $ name )) {
233
236
continue ;
234
237
}
0 commit comments