99use Php \Pie \ComposerIntegration \PieInstalledJsonMetadataKeys ;
1010use Php \Pie \File \BinaryFile ;
1111use Php \Pie \File \BinaryFileFailedVerification ;
12+ use Php \Pie \Platform as PiePlatform ;
1213use Php \Pie \Platform \InstalledPiePackages ;
1314use Php \Pie \Platform \OperatingSystem ;
1415use Psr \Container \ContainerInterface ;
1516use Symfony \Component \Console \Attribute \AsCommand ;
1617use Symfony \Component \Console \Command \Command ;
1718use Symfony \Component \Console \Input \InputInterface ;
19+ use Symfony \Component \Console \Input \InputOption ;
1820use Symfony \Component \Console \Output \NullOutput ;
1921use Symfony \Component \Console \Output \OutputInterface ;
2022
3335)]
3436final class ShowCommand extends Command
3537{
38+ private const OPTION_ALL = 'all ' ;
39+
3640 public function __construct (
3741 private readonly InstalledPiePackages $ installedPiePackages ,
3842 private readonly ContainerInterface $ container ,
@@ -45,12 +49,33 @@ public function configure(): void
4549 parent ::configure ();
4650
4751 CommandHelper::configurePhpConfigOptions ($ this );
52+
53+ $ this ->addOption (
54+ self ::OPTION_ALL ,
55+ null ,
56+ InputOption::VALUE_NONE ,
57+ 'Show all extensions for the target PHP installation, even those PIE does not manage. ' ,
58+ );
4859 }
4960
5061 public function execute (InputInterface $ input , OutputInterface $ output ): int
5162 {
63+ $ showAll = $ input ->hasOption (self ::OPTION_ALL ) && $ input ->getOption (self ::OPTION_ALL );
5264 $ targetPlatform = CommandHelper::determineTargetPlatformFromInputs ($ input , $ output );
5365
66+ if ($ output ->getVerbosity () < OutputInterface::VERBOSITY_VERBOSE ) {
67+ $ output ->writeln (
68+ sprintf (
69+ '<info>Using pie.json:</info> %s ' ,
70+ PiePlatform::getPieJsonFilename ($ targetPlatform ),
71+ ),
72+ );
73+ }
74+
75+ if (! $ showAll ) {
76+ $ output ->writeln ('Tip: to include extensions in this list that PIE does not manage, use the --all flag. ' );
77+ }
78+
5479 $ composer = PieComposerFactory::createPieComposer (
5580 $ this ->container ,
5681 PieComposerRequest::noOperation (
@@ -64,12 +89,17 @@ public function execute(InputInterface $input, OutputInterface $output): int
6489 $ extensionPath = $ targetPlatform ->phpBinaryPath ->extensionPath ();
6590 $ extensionEnding = $ targetPlatform ->operatingSystem === OperatingSystem::Windows ? '.dll ' : '.so ' ;
6691
67- $ output ->writeln ("\n" . '<info>Loaded extensions:</info> ' );
92+ $ output ->writeln (sprintf (
93+ "\n" . '<options=bold,underscore>%s:</> ' ,
94+ $ showAll ? 'All loaded extensions ' : 'Loaded PIE extensions ' ,
95+ ));
6896 array_walk (
6997 $ phpEnabledExtensions ,
70- static function (string $ version , string $ phpExtensionName ) use ($ output , $ piePackages , $ extensionPath , $ extensionEnding ): void {
98+ static function (string $ version , string $ phpExtensionName ) use ($ showAll , $ output , $ piePackages , $ extensionPath , $ extensionEnding ): void {
7199 if (! array_key_exists ($ phpExtensionName , $ piePackages )) {
72- $ output ->writeln (sprintf (' <comment>%s:%s</comment> ' , $ phpExtensionName , $ version ));
100+ if ($ showAll ) {
101+ $ output ->writeln (sprintf (' <comment>%s:%s</comment> ' , $ phpExtensionName , $ version ));
102+ }
73103
74104 return ;
75105 }
0 commit comments