@@ -77,6 +77,12 @@ protected function configure()
77
77
$ this ->trans ('commands.generate.site.alias.description ' )
78
78
)
79
79
->setHelp ($ this ->trans ('commands.generate.site.alias.help ' ))
80
+ ->addOption (
81
+ 'site ' ,
82
+ null ,
83
+ InputOption::VALUE_NONE ,
84
+ $ this ->trans ('commands.generate.site.alias.options.site ' )
85
+ )
80
86
->addOption (
81
87
'name ' ,
82
88
null ,
@@ -147,6 +153,7 @@ protected function interact(
147
153
InputInterface $ input ,
148
154
OutputInterface $ output
149
155
) {
156
+ $ site = $ input ->getOption ('site ' );
150
157
$ name = $ input ->getOption ('name ' );
151
158
if (!$ name ) {
152
159
$ sites = $ this ->configurationManager ->getSites ();
@@ -269,6 +276,10 @@ protected function interact(
269
276
}
270
277
271
278
$ directory = $ input ->getOption ('directory ' );
279
+ if ($ site && $ this ->drupalFinder ->getComposerRoot ()) {
280
+ $ directory = $ this ->drupalFinder ->getComposerRoot () . '/console/ ' ;
281
+ }
282
+
272
283
if (!$ directory ) {
273
284
$ directory = $ this ->getIo ()->choice (
274
285
$ this ->trans ('commands.generate.site.alias.questions.directory ' ),
@@ -286,6 +297,11 @@ protected function execute(
286
297
InputInterface $ input ,
287
298
OutputInterface $ output
288
299
) {
300
+ $ site = $ input ->getOption ('site ' );
301
+ $ directory = $ input ->getOption ('directory ' );
302
+ if ($ site && $ this ->drupalFinder ->isValidDrupal ()) {
303
+ $ directory = $ this ->drupalFinder ->getComposerRoot () . '/console/ ' ;
304
+ }
289
305
$ this ->generator ->generate (
290
306
[
291
307
'name ' => $ input ->getOption ('name ' ),
@@ -297,7 +313,7 @@ protected function execute(
297
313
'port ' => $ input ->getOption ('port ' ),
298
314
'user ' => $ input ->getOption ('user ' ),
299
315
'host ' => $ input ->getOption ('host ' ),
300
- 'directory ' => $ input -> getOption ( ' directory ' )
316
+ 'directory ' => $ directory
301
317
]
302
318
);
303
319
}
0 commit comments