Skip to content

Commit

Permalink
Add drush mapping (#214)
Browse files Browse the repository at this point in the history
* [console] Tag 1.0.0-rc26 release.

* [console] Add drush command mapping feature.
  • Loading branch information
jmolivas committed Aug 1, 2017
1 parent 90bd569 commit cc02721
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
6 changes: 5 additions & 1 deletion config/dist/aliases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ commands:
- uslca
user:login:url:
- usli
- uli
user:password:hash:
- usph
user:password:reset:
- upsr
views:disable:
- vdi

cache:rebuild:
- cc
update:execute:
- updb
19 changes: 18 additions & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function doRun(InputInterface $input, OutputInterface $output)


if ($commandName && !$this->has($commandName)) {
$isValidCommand = false;
$config = $configurationManager->getConfiguration();
$mappings = $config
->get('application.commands.mappings');
Expand All @@ -129,7 +130,23 @@ public function doRun(InputInterface $input, OutputInterface $output)
$this->add(
$this->find($commandNameMap)->setAliases([$commandName])
);
} else {
$isValidCommand = true;
}

$drushCommand = $configurationManager->readDrushEquivalents($commandName);
if ($drushCommand) {
$this->add(
$this->find($drushCommand)->setAliases([$commandName])
);
$isValidCommand = true;
$messages['warning'][] = sprintf(
$this->trans('application.errors.drush-command'),
$commandName,
$drushCommand
);
}

if (!$isValidCommand) {
$io->error(
sprintf(
$this->trans('application.errors.invalid-command'),
Expand Down

0 comments on commit cc02721

Please sign in to comment.