2828use Symfony \Component \Console \Input \InputInterface ;
2929use Symfony \Component \Console \Input \InputOption ;
3030use Symfony \Component \Console \Output \OutputInterface ;
31+ use Symfony \Component \Console \Question \Question ;
3132use Symfony \Component \Console \Style \SymfonyStyle ;
3233use Symfony \Component \HttpKernel \Kernel ;
3334
@@ -90,6 +91,14 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
9091 $ input ->getOption ('invokable ' ) ?
9192 $ this ->generateInvokableCommand ($ commandName , $ commandClassNameDetails , $ io , $ generator ) :
9293 $ this ->generateInheritanceCommand ($ commandName , $ commandClassNameDetails , $ io , $ generator );
94+
95+ $ generator ->writeChanges ();
96+
97+ $ this ->writeSuccessMessage ($ io );
98+ $ io ->text ([
99+ 'Next: open your new command class and customize it! ' ,
100+ 'Find the documentation at <fg=yellow>https://symfony.com/doc/current/console.html</> ' ,
101+ ]);
93102 }
94103
95104 private function generateInheritanceCommand (string $ commandName , ClassNameDetails $ commandClassNameDetails , ConsoleStyle $ io , Generator $ generator ): void
@@ -113,18 +122,12 @@ private function generateInheritanceCommand(string $commandName, ClassNameDetail
113122 'set_description ' => !class_exists (LazyCommand::class),
114123 ]
115124 );
116-
117- $ generator ->writeChanges ();
118-
119- $ this ->writeSuccessMessage ($ io );
120- $ io ->text ([
121- 'Next: open your new command class and customize it! ' ,
122- 'Find the documentation at <fg=yellow>https://symfony.com/doc/current/console.html</> ' ,
123- ]);
124125 }
125126
126127 private function generateInvokableCommand (string $ commandName , ClassNameDetails $ commandClassNameDetails , ConsoleStyle $ io , Generator $ generator ): void
127128 {
129+ $ description = $ io ->ask ('Enter a short description for your command ' );
130+
128131 $ useStatements = new UseStatementGenerator ([
129132 Argument::class,
130133 AsCommand::class,
@@ -139,16 +142,9 @@ private function generateInvokableCommand(string $commandName, ClassNameDetails
139142 [
140143 'use_statements ' => $ useStatements ,
141144 'command_name ' => $ commandName ,
145+ 'command_description ' => $ description ,
142146 ]
143147 );
144-
145- $ generator ->writeChanges ();
146-
147- $ this ->writeSuccessMessage ($ io );
148- $ io ->text ([
149- 'Next: open your new command class and customize it! ' ,
150- 'Find the documentation at <fg=yellow>https://symfony.com/doc/current/console.html</> ' ,
151- ]);
152148 }
153149
154150 public function configureDependencies (DependencyBuilder $ dependencies ): void
0 commit comments