8
8
namespace Magento \CloudDocker \Command ;
9
9
10
10
use Magento \CloudDocker \App \GenericException ;
11
+ use Magento \CloudDocker \Cli ;
11
12
use Magento \CloudDocker \Compose \DeveloperBuilder ;
12
13
use Magento \CloudDocker \Compose \BuilderFactory ;
13
14
use Magento \CloudDocker \Config \ConfigFactory ;
14
15
use Magento \CloudDocker \Config \Dist \Generator ;
15
16
use Magento \CloudDocker \Config \Source ;
16
17
use Magento \CloudDocker \Filesystem \Filesystem ;
17
18
use Symfony \Component \Console \Command \Command ;
19
+ use Symfony \Component \Console \Input \ArgvInput ;
18
20
use Symfony \Component \Console \Input \InputInterface ;
19
21
use Symfony \Component \Console \Input \InputOption ;
20
22
use Symfony \Component \Console \Output \OutputInterface ;
@@ -308,7 +310,7 @@ protected function configure(): void
308
310
*
309
311
* @throws GenericException
310
312
*/
311
- public function execute (InputInterface $ input , OutputInterface $ output )
313
+ public function execute (InputInterface $ input , OutputInterface $ output ): int
312
314
{
313
315
$ config = $ this ->configFactory ->create ([
314
316
$ this ->sourceFactory ->create (Source \BaseSource::class),
@@ -323,16 +325,24 @@ public function execute(InputInterface $input, OutputInterface $output)
323
325
324
326
$ this ->distGenerator ->generate ($ config );
325
327
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
+
326
339
$ this ->filesystem ->put (
327
340
$ 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
334
342
);
335
343
336
344
$ output ->writeln ('<info>Configuration was built.</info> ' );
345
+
346
+ return Cli::SUCCESS ;
337
347
}
338
348
}
0 commit comments