Skip to content

Commit dfa6a49

Browse files
authored
Improve init command (#155)
* [init] Remove no longer necesary variable phpCheckFileDisplay * [init] Add chain and sites copy question. * [init] Rename language keys
1 parent d0f45db commit dfa6a49

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/Command/CheckCommand.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
7777
$checks = $this->requirementChecker->getCheckResult();
7878
if (!$checks) {
7979
$phpCheckFile = $this->configurationManager->getHomeDirectory().'/.console/phpcheck.yml';
80-
$phpCheckFileDisplay = realpath($this->configurationManager->getHomeDirectory()).'/.console/phpcheck.yml';
8180

8281
if (!file_exists($phpCheckFile)) {
8382
$phpCheckFile =
8483
$this->configurationManager->getApplicationDirectory().
8584
DRUPAL_CONSOLE_CORE.
8685
'config/dist/phpcheck.yml';
87-
88-
$phpCheckFileDisplay =
89-
realpath($this->configurationManager->getApplicationDirectory()).
90-
DRUPAL_CONSOLE_CORE.
91-
'config/dist/phpcheck.yml';
9286
}
9387

9488
$io->newLine();
9589
$io->info($this->trans('commands.check.messages.file'));
96-
$io->comment($phpCheckFileDisplay);
90+
$io->comment($phpCheckFile);
9791

9892
$checks = $this->requirementChecker->validate($phpCheckFile);
9993
}

src/Command/InitCommand.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class InitCommand extends Command
5555
private $configParameters = [
5656
'language' => 'en',
5757
'temp' => '/tmp',
58+
'chain' => false,
59+
'sites' => false,
5860
'learning' => false,
5961
'generate_inline' => false,
6062
'generate_chain' => false
@@ -146,8 +148,18 @@ protected function interact(InputInterface $input, OutputInterface $output)
146148
);
147149

148150
$this->configParameters['learning'] = $io->confirm(
151+
$this->trans('commands.init.questions.chain'),
152+
false
153+
);
154+
155+
$this->configParameters['sites'] = $io->confirm(
156+
$this->trans('commands.init.questions.sites'),
157+
false
158+
);
159+
160+
$this->configParameters['chain'] = $io->confirm(
149161
$this->trans('commands.init.questions.learning'),
150-
true
162+
false
151163
);
152164

153165
$this->configParameters['generate_inline'] = $io->confirm(
@@ -191,6 +203,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
191203
DRUPAL_CONSOLE_CORE
192204
)
193205
);
206+
if (!$this->configParameters['chain']){
207+
$finder->exclude('chain');
208+
}
209+
if (!$this->configParameters['sites']){
210+
$finder->exclude('sites');
211+
}
194212
$finder->files();
195213

196214
foreach ($finder as $configFile) {

0 commit comments

Comments
 (0)