88namespace Magento \CloudDocker \Command ;
99
1010use Magento \CloudDocker \App \GenericException ;
11+ use Magento \CloudDocker \Cli ;
1112use Magento \CloudDocker \Compose \DeveloperBuilder ;
1213use Magento \CloudDocker \Compose \BuilderFactory ;
1314use Magento \CloudDocker \Config \ConfigFactory ;
1415use Magento \CloudDocker \Config \Dist \Generator ;
1516use Magento \CloudDocker \Config \Source ;
1617use Magento \CloudDocker \Filesystem \Filesystem ;
1718use Symfony \Component \Console \Command \Command ;
19+ use Symfony \Component \Console \Input \ArgvInput ;
1820use Symfony \Component \Console \Input \InputInterface ;
1921use Symfony \Component \Console \Input \InputOption ;
2022use Symfony \Component \Console \Output \OutputInterface ;
@@ -308,7 +310,7 @@ protected function configure(): void
308310 *
309311 * @throws GenericException
310312 */
311- public function execute (InputInterface $ input , OutputInterface $ output )
313+ public function execute (InputInterface $ input , OutputInterface $ output ): int
312314 {
313315 $ config = $ this ->configFactory ->create ([
314316 $ this ->sourceFactory ->create (Source \BaseSource::class),
@@ -323,16 +325,24 @@ public function execute(InputInterface $input, OutputInterface $output)
323325
324326 $ this ->distGenerator ->generate ($ config );
325327
328+ $ content = Yaml::dump ([
329+ 'version ' => $ compose ->getVersion (),
330+ 'services ' => $ compose ->getServices (),
331+ 'volumes ' => $ compose ->getVolumes (),
332+ 'networks ' => $ compose ->getNetworks ()
333+ ], 6 , 2 , Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK );
334+
335+ if ($ input instanceof ArgvInput) {
336+ $ content = '# ./vendor/bin/ece-docker ' . $ input . PHP_EOL . $ content ;
337+ }
338+
326339 $ this ->filesystem ->put (
327340 $ builder ->getPath (),
328- Yaml::dump ([
329- 'version ' => $ compose ->getVersion (),
330- 'services ' => $ compose ->getServices (),
331- 'volumes ' => $ compose ->getVolumes (),
332- 'networks ' => $ compose ->getNetworks ()
333- ], 6 , 2 , Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK )
341+ $ content
334342 );
335343
336344 $ output ->writeln ('<info>Configuration was built.</info> ' );
345+
346+ return Cli::SUCCESS ;
337347 }
338348}
0 commit comments