diff --git a/README.md b/README.md index d4480197d..b1acb6be2 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Drupal Console ============================================= [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hechoendrupal/DrupalConsole) -[![Build Status](https://travis-ci.org/hechoendrupal/DrupalConsole.svg?branch=master)](https://travis-ci.org/hechoendrupal/DrupalConsole) +[![Build Status](https://travis-ci.org/hechoendrupal/drupal-console.svg?branch=master)](https://travis-ci.org/hechoendrupal/drupal-console) [![Latest Stable Version](https://poser.pugx.org/drupal/console/v/stable.svg)](https://packagist.org/packages/drupal/console) [![Latest Unstable Version](https://poser.pugx.org/drupal/console/v/unstable.svg)](https://packagist.org/packages/drupal/console) [![Software License](https://img.shields.io/badge/license-GPL%202.0+-blue.svg)](https://packagist.org/packages/drupal/console) diff --git a/composer.lock b/composer.lock index 996933354..a43f3a4fc 100644 --- a/composer.lock +++ b/composer.lock @@ -752,16 +752,16 @@ }, { "name": "drupal/console-extend-plugin", - "version": "0.8.0", + "version": "0.9.1", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-extend-plugin.git", - "reference": "d69ffe413259781c4257ab42bd79c9da9042e87e" + "reference": "ae2a76680f93c0fea31bbcafc6b0bcc234bb2fb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/d69ffe413259781c4257ab42bd79c9da9042e87e", - "reference": "d69ffe413259781c4257ab42bd79c9da9042e87e", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/ae2a76680f93c0fea31bbcafc6b0bcc234bb2fb4", + "reference": "ae2a76680f93c0fea31bbcafc6b0bcc234bb2fb4", "shasum": "" }, "require": { @@ -789,7 +789,7 @@ } ], "description": "Drupal Console Extend Plugin", - "time": "2017-06-08T16:06:59+00:00" + "time": "2017-07-07T05:12:50+00:00" }, { "name": "gabordemooij/redbean", @@ -1144,16 +1144,16 @@ }, { "name": "nikic/php-parser", - "version": "v3.0.5", + "version": "v3.0.6", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d" + "reference": "0808939f81c1347a3c8a82a5925385a08074b0f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2b9e2f71b722f7c53918ab0c25f7646c2013f17d", - "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0808939f81c1347a3c8a82a5925385a08074b0f1", + "reference": "0808939f81c1347a3c8a82a5925385a08074b0f1", "shasum": "" }, "require": { @@ -1191,7 +1191,7 @@ "parser", "php" ], - "time": "2017-03-05T18:23:57+00:00" + "time": "2017-06-28T20:53:48+00:00" }, { "name": "psr/http-message", @@ -1292,16 +1292,16 @@ }, { "name": "psy/psysh", - "version": "v0.8.8", + "version": "v0.8.9", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e" + "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/fe65c30cbc55c71e61ba3a38b5a581149be31b8e", - "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/58a31cc4404c8f632d8c557bc72056af2d3a83db", + "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db", "shasum": "" }, "require": { @@ -1361,7 +1361,7 @@ "interactive", "shell" ], - "time": "2017-06-24T06:16:19+00:00" + "time": "2017-07-06T14:53:52+00:00" }, { "name": "stecman/symfony-console-completion", @@ -1410,7 +1410,7 @@ }, { "name": "symfony/config", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -1466,16 +1466,16 @@ }, { "name": "symfony/console", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462" + "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3ef6ef64abecd566d551d9e7f6393ac6e93b2462", - "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462", + "url": "https://api.github.com/repos/symfony/console/zipball/46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", + "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", "shasum": "" }, "require": { @@ -1523,11 +1523,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-06-02T14:36:56+00:00" + "time": "2017-07-03T08:04:30+00:00" }, { "name": "symfony/css-selector", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -1580,7 +1580,7 @@ }, { "name": "symfony/debug", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -1637,16 +1637,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "b4a4b8f6ae1d69a6b2c0c31623bbc474121ee075" + "reference": "66d2e252262749e0f3c735c183e4562c72ffb8c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b4a4b8f6ae1d69a6b2c0c31623bbc474121ee075", - "reference": "b4a4b8f6ae1d69a6b2c0c31623bbc474121ee075", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/66d2e252262749e0f3c735c183e4562c72ffb8c8", + "reference": "66d2e252262749e0f3c735c183e4562c72ffb8c8", "shasum": "" }, "require": { @@ -1696,11 +1696,11 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-06-02T14:36:56+00:00" + "time": "2017-06-14T00:55:24+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -1756,7 +1756,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1816,7 +1816,7 @@ }, { "name": "symfony/expression-language", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", @@ -1865,16 +1865,16 @@ }, { "name": "symfony/filesystem", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "19c11158da8d110cc5289c063bf2ec4cc1ce9e7c" + "reference": "b8c9c18eacc525c980d27c7a2c8fd1e09e0ed4c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/19c11158da8d110cc5289c063bf2ec4cc1ce9e7c", - "reference": "19c11158da8d110cc5289c063bf2ec4cc1ce9e7c", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8c9c18eacc525c980d27c7a2c8fd1e09e0ed4c7", + "reference": "b8c9c18eacc525c980d27c7a2c8fd1e09e0ed4c7", "shasum": "" }, "require": { @@ -1910,11 +1910,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-05-28T14:07:33+00:00" + "time": "2017-06-20T23:27:56+00:00" }, { "name": "symfony/finder", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1963,16 +1963,16 @@ }, { "name": "symfony/http-foundation", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "de8d8e83b9ec898e14ef8db84cee5919753b2ae5" + "reference": "2b592ca5fe2ad7ee8a92d409d2b830277ad58231" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/de8d8e83b9ec898e14ef8db84cee5919753b2ae5", - "reference": "de8d8e83b9ec898e14ef8db84cee5919753b2ae5", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/2b592ca5fe2ad7ee8a92d409d2b830277ad58231", + "reference": "2b592ca5fe2ad7ee8a92d409d2b830277ad58231", "shasum": "" }, "require": { @@ -2014,7 +2014,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" + "time": "2017-06-20T23:27:56+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -2191,16 +2191,16 @@ }, { "name": "symfony/process", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9" + "reference": "57e52a0a6a80ea0aec4fc1b785a7920a95cb88a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d54232f5682fda2f8bbebff7c81b864646867ab9", - "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9", + "url": "https://api.github.com/repos/symfony/process/zipball/57e52a0a6a80ea0aec4fc1b785a7920a95cb88a8", + "reference": "57e52a0a6a80ea0aec4fc1b785a7920a95cb88a8", "shasum": "" }, "require": { @@ -2236,20 +2236,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-05-08T01:19:21+00:00" + "time": "2017-07-03T08:04:30+00:00" }, { "name": "symfony/translation", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "14db4cc1172a722aaa3b558bfa8eff593b43cd46" + "reference": "a89af885b8c6d0142c79a02ca9cc059ed25d40d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/14db4cc1172a722aaa3b558bfa8eff593b43cd46", - "reference": "14db4cc1172a722aaa3b558bfa8eff593b43cd46", + "url": "https://api.github.com/repos/symfony/translation/zipball/a89af885b8c6d0142c79a02ca9cc059ed25d40d8", + "reference": "a89af885b8c6d0142c79a02ca9cc059ed25d40d8", "shasum": "" }, "require": { @@ -2300,20 +2300,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" + "time": "2017-06-24T16:44:49+00:00" }, { "name": "symfony/var-dumper", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "347c4247a3e40018810b476fcd5dec36d46d08dc" + "reference": "9ee920bba1d2ce877496dcafca7cbffff4dbe08a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/347c4247a3e40018810b476fcd5dec36d46d08dc", - "reference": "347c4247a3e40018810b476fcd5dec36d46d08dc", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9ee920bba1d2ce877496dcafca7cbffff4dbe08a", + "reference": "9ee920bba1d2ce877496dcafca7cbffff4dbe08a", "shasum": "" }, "require": { @@ -2368,11 +2368,11 @@ "debug", "dump" ], - "time": "2017-06-02T09:10:29+00:00" + "time": "2017-07-05T13:02:37+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -2421,16 +2421,16 @@ }, { "name": "twig/twig", - "version": "v1.34.3", + "version": "v1.34.4", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e" + "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", - "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/f878bab48edb66ad9c6ed626bf817f60c6c096ee", + "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee", "shasum": "" }, "require": { @@ -2482,7 +2482,7 @@ "keywords": [ "templating" ], - "time": "2017-06-07T18:45:17+00:00" + "time": "2017-07-04T13:19:31+00:00" }, { "name": "vlucas/phpdotenv", diff --git a/config/services/theme.yml b/config/services/theme.yml index c66cc79aa..c4df2771c 100644 --- a/config/services/theme.yml +++ b/config/services/theme.yml @@ -13,7 +13,7 @@ services: lazy: true console.theme_path: class: Drupal\Console\Command\Theme\PathCommand - arguments: ['@console.extension_manager'] + arguments: ['@console.extension_manager','@theme_handler'] tags: - { name: drupal.command } lazy: true diff --git a/src/Application.php b/src/Application.php index 3dd0209ab..af5e13c7c 100644 --- a/src/Application.php +++ b/src/Application.php @@ -206,10 +206,10 @@ private function registerCommands() } if (array_key_exists($command->getName(), $aliases)) { - $commandAliases = array_merge( + $commandAliases = array_unique(array_merge( $command->getAliases(), $aliases[$command->getName()] - ); + )); if (!is_array($commandAliases)) { $commandAliases = [$commandAliases]; } diff --git a/src/Command/Config/DeleteCommand.php b/src/Command/Config/DeleteCommand.php index 7ab29c664..99ce41e8b 100644 --- a/src/Command/Config/DeleteCommand.php +++ b/src/Command/Config/DeleteCommand.php @@ -73,7 +73,7 @@ protected function configure() 'name', InputArgument::OPTIONAL, $this->trans('commands.config.delete.arguments.name') - ); + )->setAliases(['cd']); } /** diff --git a/src/Command/Config/DiffCommand.php b/src/Command/Config/DiffCommand.php index c8afc9705..c97513940 100644 --- a/src/Command/Config/DiffCommand.php +++ b/src/Command/Config/DiffCommand.php @@ -79,7 +79,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.config.diff.options.reverse') - ); + )->setAliases(['cdi']); } /** diff --git a/src/Command/Config/EditCommand.php b/src/Command/Config/EditCommand.php index ad218e358..bd5ad9576 100644 --- a/src/Command/Config/EditCommand.php +++ b/src/Command/Config/EditCommand.php @@ -76,7 +76,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.config.edit.arguments.editor') ) - ->setAliases(['cdit']); + ->setAliases(['ced']); } /** diff --git a/src/Command/Config/ValidateCommand.php b/src/Command/Config/ValidateCommand.php index f15a202ac..bf9f5faf3 100644 --- a/src/Command/Config/ValidateCommand.php +++ b/src/Command/Config/ValidateCommand.php @@ -38,7 +38,7 @@ protected function configure() ->addArgument( 'name', InputArgument::REQUIRED - ); + )->setAliases(['cv']); } /** diff --git a/src/Command/Create/CommentsCommand.php b/src/Command/Create/CommentsCommand.php index ff04f0584..ec8e310a5 100644 --- a/src/Command/Create/CommentsCommand.php +++ b/src/Command/Create/CommentsCommand.php @@ -72,7 +72,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.comments.options.time-range') - ); + )->setAliases(['crc']); } /** diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index 36f3d98a4..0fd33f93f 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -95,7 +95,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.nodes.options.language') - ); + )->setAliases(['crn']); } /** diff --git a/src/Command/Create/TermsCommand.php b/src/Command/Create/TermsCommand.php index a2bd1ab3b..96cc757f7 100644 --- a/src/Command/Create/TermsCommand.php +++ b/src/Command/Create/TermsCommand.php @@ -80,7 +80,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.terms.options.name-words') - ); + )->setAliases(['crt']); } /** diff --git a/src/Command/Create/UsersCommand.php b/src/Command/Create/UsersCommand.php index 4fc6c1f74..89e91f299 100644 --- a/src/Command/Create/UsersCommand.php +++ b/src/Command/Create/UsersCommand.php @@ -82,7 +82,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.users.options.time-range') - ); + )->setAliases(['cru']); } /** diff --git a/src/Command/Create/VocabulariesCommand.php b/src/Command/Create/VocabulariesCommand.php index 4af224444..65087d2f1 100644 --- a/src/Command/Create/VocabulariesCommand.php +++ b/src/Command/Create/VocabulariesCommand.php @@ -59,7 +59,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.vocabularies.options.name-words') - ); + )->setAliases(['crv']); } /** diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index 6fdb3caac..6e6edb636 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -76,7 +76,7 @@ protected function configure() InputArgument::IS_ARRAY | InputArgument::OPTIONAL, $this->trans('commands.common.options.module') ) - ->setAliases(['cre']); + ->setAliases(['croe']); } /** diff --git a/src/Command/Cron/ReleaseCommand.php b/src/Command/Cron/ReleaseCommand.php index 0d54a5c8f..a4a0ff067 100644 --- a/src/Command/Cron/ReleaseCommand.php +++ b/src/Command/Cron/ReleaseCommand.php @@ -53,7 +53,7 @@ protected function configure() $this ->setName('cron:release') ->setDescription($this->trans('commands.cron.release.description')) - ->setAliases(['crr']); + ->setAliases(['cror']); } /** diff --git a/src/Command/Database/AddCommand.php b/src/Command/Database/AddCommand.php index 1e2087a10..ee9f3591d 100644 --- a/src/Command/Database/AddCommand.php +++ b/src/Command/Database/AddCommand.php @@ -90,7 +90,8 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.database.add.options.driver') ) - ->setHelp($this->trans('commands.database.add.help')); + ->setHelp($this->trans('commands.database.add.help')) + ->setAliases(['dba']); } /** * {@inheritdoc} diff --git a/src/Command/Database/ClientCommand.php b/src/Command/Database/ClientCommand.php index 93b2d6574..a36af091b 100644 --- a/src/Command/Database/ClientCommand.php +++ b/src/Command/Database/ClientCommand.php @@ -35,7 +35,8 @@ protected function configure() $this->trans('commands.database.client.arguments.database'), 'default' ) - ->setHelp($this->trans('commands.database.client.help')); + ->setHelp($this->trans('commands.database.client.help')) + ->setAliases(['dbc']); } /** diff --git a/src/Command/Database/ConnectCommand.php b/src/Command/Database/ConnectCommand.php index 1908cb0e0..caedf4fe6 100644 --- a/src/Command/Database/ConnectCommand.php +++ b/src/Command/Database/ConnectCommand.php @@ -34,7 +34,8 @@ protected function configure() $this->trans('commands.database.connect.arguments.database'), 'default' ) - ->setHelp($this->trans('commands.database.connect.help')); + ->setHelp($this->trans('commands.database.connect.help')) + ->setAliases(['dbco']); } /** diff --git a/src/Command/Database/DropCommand.php b/src/Command/Database/DropCommand.php index 651f5fda4..09b67fd22 100644 --- a/src/Command/Database/DropCommand.php +++ b/src/Command/Database/DropCommand.php @@ -56,7 +56,8 @@ protected function configure() $this->trans('commands.database.drop.arguments.database'), 'default' ) - ->setHelp($this->trans('commands.database.drop.help')); + ->setHelp($this->trans('commands.database.drop.help')) + ->setAliases(['dbd']); } /** diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index b867b517b..403f195f2 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -70,7 +70,8 @@ protected function configure() InputOption::VALUE_NONE, $this->trans('commands.database.dump.options.gz') ) - ->setHelp($this->trans('commands.database.dump.help')); + ->setHelp($this->trans('commands.database.dump.help')) + ->setAliases(['dbdu']); } /** diff --git a/src/Command/Database/LogClearCommand.php b/src/Command/Database/LogClearCommand.php index c8e96eb36..266a62bcb 100644 --- a/src/Command/Database/LogClearCommand.php +++ b/src/Command/Database/LogClearCommand.php @@ -68,7 +68,7 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.clear.options.user-id') ) - ->setAliases(['dbc']); + ->setAliases(['dblc']); } /** diff --git a/src/Command/Database/LogPollCommand.php b/src/Command/Database/LogPollCommand.php index 46a0d6257..eee78b5cc 100644 --- a/src/Command/Database/LogPollCommand.php +++ b/src/Command/Database/LogPollCommand.php @@ -50,7 +50,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.database.log.poll.arguments.duration'), '10' - ); + )->setAliases(['dblp']); } /** diff --git a/src/Command/Database/QueryCommand.php b/src/Command/Database/QueryCommand.php index d5ee1139e..ea9479be9 100644 --- a/src/Command/Database/QueryCommand.php +++ b/src/Command/Database/QueryCommand.php @@ -54,7 +54,8 @@ protected function configure() ->addOption('vertical', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.vertical')) ->addOption('batch', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.batch')) - ->setHelp($this->trans('commands.database.query.help')); + ->setHelp($this->trans('commands.database.query.help')) + ->setAliases(['dbq']); } /** diff --git a/src/Command/Database/RestoreCommand.php b/src/Command/Database/RestoreCommand.php index d94b336d9..4e6c8d6d7 100644 --- a/src/Command/Database/RestoreCommand.php +++ b/src/Command/Database/RestoreCommand.php @@ -58,7 +58,8 @@ protected function configure() InputOption::VALUE_REQUIRED, $this->trans('commands.database.restore.options.file') ) - ->setHelp($this->trans('commands.database.restore.help')); + ->setHelp($this->trans('commands.database.restore.help')) + ->setAliases(['dbr']); } /** diff --git a/src/Command/Debug/BreakpointsCommand.php b/src/Command/Debug/BreakpointsCommand.php index 41b7730fa..0c6f5603e 100644 --- a/src/Command/Debug/BreakpointsCommand.php +++ b/src/Command/Debug/BreakpointsCommand.php @@ -64,7 +64,7 @@ protected function configure() 'group', InputArgument::OPTIONAL, $this->trans('commands.debug.breakpoints.options.group-name') - ); + )->setAliases(['dbre']); } /** diff --git a/src/Command/Debug/CacheContextCommand.php b/src/Command/Debug/CacheContextCommand.php index d1aa713fc..5ffa1cd08 100644 --- a/src/Command/Debug/CacheContextCommand.php +++ b/src/Command/Debug/CacheContextCommand.php @@ -29,7 +29,8 @@ protected function configure() { $this ->setName('debug:cache:context') - ->setDescription($this->trans('commands.debug.cache.context.description')); + ->setDescription($this->trans('commands.debug.cache.context.description')) + ->setAliases(['dcc']); } /** diff --git a/src/Command/Debug/ConfigCommand.php b/src/Command/Debug/ConfigCommand.php index 4e5e0f278..d7d4527fb 100644 --- a/src/Command/Debug/ConfigCommand.php +++ b/src/Command/Debug/ConfigCommand.php @@ -59,7 +59,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.debug.config.arguments.name') ) - ->setAliases(['cde']); + ->setAliases(['dc']); } /** diff --git a/src/Command/Debug/ConfigSettingsCommand.php b/src/Command/Debug/ConfigSettingsCommand.php index 9dfe2d4b1..0ce42485e 100644 --- a/src/Command/Debug/ConfigSettingsCommand.php +++ b/src/Command/Debug/ConfigSettingsCommand.php @@ -48,7 +48,8 @@ protected function configure() $this ->setName('debug:config:settings') ->setDescription($this->trans('commands.debug.config.settings.description')) - ->setHelp($this->trans('commands.debug.config.settings.help')); + ->setHelp($this->trans('commands.debug.config.settings.help')) + ->setAliases(['dcs']); } /** diff --git a/src/Command/Debug/ConfigValidateCommand.php b/src/Command/Debug/ConfigValidateCommand.php index ab31d2c6f..451679a74 100644 --- a/src/Command/Debug/ConfigValidateCommand.php +++ b/src/Command/Debug/ConfigValidateCommand.php @@ -50,7 +50,7 @@ protected function configure() 'schema-name', 'sch', InputOption::VALUE_REQUIRED - ); + )->setAliases(['dcv']); } /** diff --git a/src/Command/Debug/CronCommand.php b/src/Command/Debug/CronCommand.php index be6740f91..623d989b3 100644 --- a/src/Command/Debug/CronCommand.php +++ b/src/Command/Debug/CronCommand.php @@ -41,7 +41,8 @@ protected function configure() { $this ->setName('debug:cron') - ->setDescription($this->trans('commands.debug.cron.description')); + ->setDescription($this->trans('commands.debug.cron.description')) + ->setAliases(['dcr']); } /** diff --git a/src/Command/Debug/DatabaseTableCommand.php b/src/Command/Debug/DatabaseTableCommand.php index dd96613c0..8746b4a69 100644 --- a/src/Command/Debug/DatabaseTableCommand.php +++ b/src/Command/Debug/DatabaseTableCommand.php @@ -74,7 +74,8 @@ protected function configure() $this->trans('commands.debug.database.table.arguments.table'), null ) - ->setHelp($this->trans('commands.debug.database.table.help')); + ->setHelp($this->trans('commands.debug.database.table.help')) + ->setAliases(['ddt']); } /** diff --git a/src/Command/Debug/EntityCommand.php b/src/Command/Debug/EntityCommand.php index 6f1c25ddd..803f9f275 100644 --- a/src/Command/Debug/EntityCommand.php +++ b/src/Command/Debug/EntityCommand.php @@ -55,7 +55,7 @@ protected function configure() 'entity-type', InputArgument::OPTIONAL, $this->trans('commands.debug.entity.arguments.entity-type') - ); + )->setAliases(['de']); } /** diff --git a/src/Command/Debug/EventCommand.php b/src/Command/Debug/EventCommand.php index f3584a909..5d27e01a6 100644 --- a/src/Command/Debug/EventCommand.php +++ b/src/Command/Debug/EventCommand.php @@ -51,7 +51,8 @@ protected function configure() $this->trans('commands.debug.event.arguments.event'), null ) - ->setHelp($this->trans('commands.debug.event.blerp')); + ->setHelp($this->trans('commands.debug.event.blerp')) + ->setAliases(['dev']); } /** diff --git a/src/Command/Debug/ImageStylesCommand.php b/src/Command/Debug/ImageStylesCommand.php index a330ebbaa..0bf1bb6a9 100644 --- a/src/Command/Debug/ImageStylesCommand.php +++ b/src/Command/Debug/ImageStylesCommand.php @@ -46,7 +46,8 @@ protected function configure() { $this ->setName('debug:image:styles') - ->setDescription($this->trans('commands.debug.image.styles.description')); + ->setDescription($this->trans('commands.debug.image.styles.description')) + ->setAliases(['dis']); } /** diff --git a/src/Command/Debug/LibrariesCommand.php b/src/Command/Debug/LibrariesCommand.php index b1a3c85cf..41875a71f 100644 --- a/src/Command/Debug/LibrariesCommand.php +++ b/src/Command/Debug/LibrariesCommand.php @@ -75,7 +75,7 @@ protected function configure() 'group', InputArgument::OPTIONAL, $this->trans('commands.debug.libraries.options.name') - ); + )->setAliases(['dl']); } /** diff --git a/src/Command/Debug/ModuleCommand.php b/src/Command/Debug/ModuleCommand.php index ee1b8f6c2..4a8767abc 100644 --- a/src/Command/Debug/ModuleCommand.php +++ b/src/Command/Debug/ModuleCommand.php @@ -79,7 +79,7 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.debug.module.options.type') ) - ->setAliases(['mod']); + ->setAliases(['dm']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Debug/MultisiteCommand.php b/src/Command/Debug/MultisiteCommand.php index a05a2177e..333af16b0 100644 --- a/src/Command/Debug/MultisiteCommand.php +++ b/src/Command/Debug/MultisiteCommand.php @@ -44,7 +44,7 @@ public function configure() ->setName('debug:multisite') ->setDescription($this->trans('commands.debug.multisite.description')) ->setHelp($this->trans('commands.debug.multisite.help')) - ->setAliases(['msd']); + ->setAliases(['dmu']); ; } diff --git a/src/Command/Debug/PermissionCommand.php b/src/Command/Debug/PermissionCommand.php index d94fe62e5..8481ab8b2 100644 --- a/src/Command/Debug/PermissionCommand.php +++ b/src/Command/Debug/PermissionCommand.php @@ -34,7 +34,7 @@ protected function configure() 'role', InputArgument::OPTIONAL, $this->trans('commands.debug.permission.arguments.role') - ); + )->setAliases(['dp']); } /** diff --git a/src/Command/Debug/PluginCommand.php b/src/Command/Debug/PluginCommand.php index 58240874e..408c94d4e 100644 --- a/src/Command/Debug/PluginCommand.php +++ b/src/Command/Debug/PluginCommand.php @@ -40,7 +40,7 @@ protected function configure() 'id', InputArgument::OPTIONAL, $this->trans('commands.debug.plugin.arguments.id') - ); + )->setAliases(['dpl']); } /** diff --git a/src/Command/Debug/QueueCommand.php b/src/Command/Debug/QueueCommand.php index 13a051cf3..69af8bdff 100644 --- a/src/Command/Debug/QueueCommand.php +++ b/src/Command/Debug/QueueCommand.php @@ -46,7 +46,8 @@ protected function configure() { $this ->setName('debug:queue') - ->setDescription($this->trans('commands.debug.queue.description')); + ->setDescription($this->trans('commands.debug.queue.description')) + ->setAliases(['dq']); } /** diff --git a/src/Command/Debug/RouterCommand.php b/src/Command/Debug/RouterCommand.php index 42e65ff33..a5e28fda8 100644 --- a/src/Command/Debug/RouterCommand.php +++ b/src/Command/Debug/RouterCommand.php @@ -46,7 +46,7 @@ protected function configure() InputArgument::OPTIONAL | InputArgument::IS_ARRAY, $this->trans('commands.debug.router.arguments.route-name') ) - ->setAliases(['rod']); + ->setAliases(['dr']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Debug/ThemeCommand.php b/src/Command/Debug/ThemeCommand.php index 3485e9100..601228947 100644 --- a/src/Command/Debug/ThemeCommand.php +++ b/src/Command/Debug/ThemeCommand.php @@ -55,7 +55,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.debug.theme.arguments.theme') ) - ->setAliases(['tde']); + ->setAliases(['dt']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Debug/UpdateCommand.php b/src/Command/Debug/UpdateCommand.php index 5cdca2e76..f61a3684e 100644 --- a/src/Command/Debug/UpdateCommand.php +++ b/src/Command/Debug/UpdateCommand.php @@ -52,7 +52,7 @@ protected function configure() $this ->setName('debug:update') ->setDescription($this->trans('commands.debug.update.description')) - ->setAliases(['upd']); + ->setAliases(['du']); } /** diff --git a/src/Command/Debug/UserCommand.php b/src/Command/Debug/UserCommand.php index c30df8109..a453c578e 100644 --- a/src/Command/Debug/UserCommand.php +++ b/src/Command/Debug/UserCommand.php @@ -96,7 +96,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.debug.user.options.limit') - ); + )->setAliases(['dus']); } /** diff --git a/src/Command/Debug/ViewsPluginsCommand.php b/src/Command/Debug/ViewsPluginsCommand.php index 7a3e9884c..728e465b8 100644 --- a/src/Command/Debug/ViewsPluginsCommand.php +++ b/src/Command/Debug/ViewsPluginsCommand.php @@ -35,7 +35,7 @@ protected function configure() 'type', InputArgument::OPTIONAL, $this->trans('commands.debug.views.plugins.arguments.type') - ); + )->setAliases(['dvp']); } /** diff --git a/src/Command/DevelDumperCommand.php b/src/Command/DevelDumperCommand.php index 4748f4ea9..97a246b9d 100644 --- a/src/Command/DevelDumperCommand.php +++ b/src/Command/DevelDumperCommand.php @@ -55,7 +55,7 @@ protected function configure() 'dumper', InputArgument::OPTIONAL, $this->trans('Name of the devel dumper plugin') - ); + )->setAliases(['dd']); } /** diff --git a/src/Command/Entity/DeleteCommand.php b/src/Command/Entity/DeleteCommand.php index 895db67d6..561e5a5b6 100644 --- a/src/Command/Entity/DeleteCommand.php +++ b/src/Command/Entity/DeleteCommand.php @@ -60,7 +60,7 @@ protected function configure() 'entity-id', InputArgument::REQUIRED, $this->trans('commands.entity.delete.arguments.entity-id') - ); + )->setAliases(['ed']); } /** diff --git a/src/Command/Features/ImportCommand.php b/src/Command/Features/ImportCommand.php index 275859fb1..e315b9d90 100644 --- a/src/Command/Features/ImportCommand.php +++ b/src/Command/Features/ImportCommand.php @@ -49,7 +49,8 @@ protected function configure() 'packages', InputArgument::IS_ARRAY, $this->trans('commands.features.import.arguments.packages') - ); + )->setAliases(['fei']); + ; } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Field/InfoCommand.php b/src/Command/Field/InfoCommand.php index 7810be768..002359d48 100644 --- a/src/Command/Field/InfoCommand.php +++ b/src/Command/Field/InfoCommand.php @@ -75,7 +75,7 @@ public function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.field.info.options.bundle') - ); + )->setAliases(['fii']); } /** diff --git a/src/Command/Image/StylesFlushCommand.php b/src/Command/Image/StylesFlushCommand.php index afc963ef3..cd85dea71 100644 --- a/src/Command/Image/StylesFlushCommand.php +++ b/src/Command/Image/StylesFlushCommand.php @@ -43,7 +43,7 @@ protected function configure() 'styles', InputArgument::IS_ARRAY | InputArgument::REQUIRED, $this->trans('commands.image.styles.flush.options.image-style') - ); + )->setAliases(['isf']); } /** diff --git a/src/Command/Module/DownloadCommand.php b/src/Command/Module/DownloadCommand.php index c6ebf70f2..8640f4027 100644 --- a/src/Command/Module/DownloadCommand.php +++ b/src/Command/Module/DownloadCommand.php @@ -138,7 +138,7 @@ protected function configure() InputOption::VALUE_NONE, $this->trans('commands.module.install.options.unstable') ) - ->setAliases(['md']); + ->setAliases(['mod']); } /** diff --git a/src/Command/Module/InstallDependencyCommand.php b/src/Command/Module/InstallDependencyCommand.php index 56ca8694a..884a2be7b 100644 --- a/src/Command/Module/InstallDependencyCommand.php +++ b/src/Command/Module/InstallDependencyCommand.php @@ -18,7 +18,7 @@ use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; use Drupal\Console\Utils\Validator; -use Drupal\Core\ProxyClass\Extension\ModuleInstaller; +use Drupal\Core\Extension\ModuleInstallerInterface; use Drupal\Console\Core\Utils\ChainQueue; /** @@ -38,13 +38,13 @@ class InstallDependencyCommand extends Command protected $site; /** - * @var Validator -*/ + * @var Validator + */ protected $validator; /** - * @var ModuleInstaller -*/ + * @var ModuleInstallerInterface + */ protected $moduleInstaller; /** @@ -55,14 +55,15 @@ class InstallDependencyCommand extends Command /** * InstallCommand constructor. * - * @param Site $site - * @param Validator $validator - * @param ChainQueue $chainQueue + * @param Site $site + * @param Validator $validator + * @param ModuleInstallerInterface $moduleInstaller + * @param ChainQueue $chainQueue */ public function __construct( Site $site, Validator $validator, - ModuleInstaller $moduleInstaller, + ModuleInstallerInterface $moduleInstaller, ChainQueue $chainQueue ) { $this->site = $site; @@ -84,7 +85,7 @@ protected function configure() 'module', InputArgument::IS_ARRAY, $this->trans('commands.module.install.dependencies.arguments.module') - ); + )->setAliases(['modi']); } /** diff --git a/src/Command/Module/PathCommand.php b/src/Command/Module/PathCommand.php index ff1500852..a32f6cf42 100644 --- a/src/Command/Module/PathCommand.php +++ b/src/Command/Module/PathCommand.php @@ -53,7 +53,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.path.options.absolute') - ); + )->setAliases(['mop']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Module/UpdateCommand.php b/src/Command/Module/UpdateCommand.php index a443fa851..349c51417 100644 --- a/src/Command/Module/UpdateCommand.php +++ b/src/Command/Module/UpdateCommand.php @@ -68,7 +68,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.update.options.simulate') - ); + )->setAliases(['mou']); } /** diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index e783d4b5c..008bb09c2 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -74,7 +74,7 @@ public function configure() InputOption::VALUE_NONE, $this->trans('commands.multisite.new.options.copy-default') ) - ->setAliases(['sn']); + ->setAliases(['mun']); } /** diff --git a/src/Command/Node/AccessRebuildCommand.php b/src/Command/Node/AccessRebuildCommand.php index b950e2d65..e8abf86a6 100644 --- a/src/Command/Node/AccessRebuildCommand.php +++ b/src/Command/Node/AccessRebuildCommand.php @@ -53,7 +53,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.node.access.rebuild.options.batch') - ); + )->setAliases(['nar']); } /** diff --git a/src/Command/Queue/RunCommand.php b/src/Command/Queue/RunCommand.php index e2df4760c..7fac3e05d 100644 --- a/src/Command/Queue/RunCommand.php +++ b/src/Command/Queue/RunCommand.php @@ -63,7 +63,7 @@ protected function configure() 'name', InputArgument::OPTIONAL, $this->trans('commands.queue.run.arguments.name') - ); + )->setAliases(['qr']); } /** diff --git a/src/Command/Rest/DisableCommand.php b/src/Command/Rest/DisableCommand.php index a13477167..a2778574b 100644 --- a/src/Command/Rest/DisableCommand.php +++ b/src/Command/Rest/DisableCommand.php @@ -64,7 +64,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.rest.debug.arguments.resource-id') ) - ->setAliases(['redi']); + ->setAliases(['red']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Router/RebuildCommand.php b/src/Command/Router/RebuildCommand.php index 1faca8cad..e1b06ef73 100644 --- a/src/Command/Router/RebuildCommand.php +++ b/src/Command/Router/RebuildCommand.php @@ -39,7 +39,7 @@ protected function configure() $this ->setName('router:rebuild') ->setDescription($this->trans('commands.router.rebuild.description')) - ->setAliases(['ror']); + ->setAliases(['rr']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Site/ImportLocalCommand.php b/src/Command/Site/ImportLocalCommand.php index 5a31a46ea..9b030cbed 100644 --- a/src/Command/Site/ImportLocalCommand.php +++ b/src/Command/Site/ImportLocalCommand.php @@ -76,7 +76,8 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.site.import.local.options.environment') ) - ->setHelp($this->trans('commands.site.import.local.help')); + ->setHelp($this->trans('commands.site.import.local.help')) + ->setAliases(['sil']); ; } diff --git a/src/Command/Site/StatisticsCommand.php b/src/Command/Site/StatisticsCommand.php index bd6f7bff1..4a4a6aede 100644 --- a/src/Command/Site/StatisticsCommand.php +++ b/src/Command/Site/StatisticsCommand.php @@ -75,7 +75,8 @@ public function configure() $this ->setName('site:statistics') ->setDescription($this->trans('commands.site.statistics.description')) - ->setHelp($this->trans('commands.site.statistics.help')); + ->setHelp($this->trans('commands.site.statistics.help')) + ->setAliases(['sst']); ; } diff --git a/src/Command/State/DeleteCommand.php b/src/Command/State/DeleteCommand.php index 402f878aa..5c3bf1596 100644 --- a/src/Command/State/DeleteCommand.php +++ b/src/Command/State/DeleteCommand.php @@ -56,7 +56,7 @@ protected function configure() 'name', InputArgument::OPTIONAL, $this->trans('commands.state.delete.arguments.name') - ); + )->setAliases(['std']); } /** diff --git a/src/Command/State/OverrideCommand.php b/src/Command/State/OverrideCommand.php index b7a8932bb..dc1f88d99 100644 --- a/src/Command/State/OverrideCommand.php +++ b/src/Command/State/OverrideCommand.php @@ -69,7 +69,7 @@ protected function configure() 'value', InputArgument::OPTIONAL, $this->trans('commands.state.override.arguments.value') - ); + )->setAliases(['sto']); } /** * {@inheritdoc} diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index 62e2ff955..98832b488 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -40,8 +40,8 @@ public function __construct(EntityTypeManagerInterface $entityTypeManager) } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function configure() { $this @@ -50,55 +50,103 @@ protected function configure() ->addArgument( 'vid', InputArgument::REQUIRED - ); + )->setAliases(['ttd']); } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { $vid = $input->getArgument('vid'); $io = new DrupalStyle($input, $output); + if ($vid === 'all') { + $vid = $vid; + } elseif (!in_array($vid, array_keys($this->getVocabularies()))) { + + $io->error( + sprintf( + $this->trans('commands.taxonomy.term.delete.messages.invalid-vocabulary'), + $vid + ) + ); + return; + + } $this->deleteExistingTerms($vid, $io); + } - return 0; + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --vid argument + $vid = $input->getArgument('vid'); + if (!$vid) { + $vid = $io->choiceNoList( + $this->trans('commands.taxonomy.term.delete.vid'), + array_keys($this->getVocabularies()) + ); + $input->setArgument('vid', $vid); + } } /** - * Destroy all existing terms before import - * - * @param $vid - * @param $io - */ + * Destroy all existing terms + * @param $vid + * @param $io + */ private function deleteExistingTerms($vid = null, DrupalStyle $io) { - //Load the vid + $termStorage = $this->entityTypeManager->getStorage('taxonomy_term'); - $vocabularies = $this->entityTypeManager->getStorage('taxonomy_vocabulary') - ->loadMultiple(); + //Load all vocabularies + $vocabularies = $this->getVocabularies(); - if ($vid !== 'all') { - $vid = [$vid]; - } else { + if ($vid === 'all') { $vid = array_keys($vocabularies); + } else { + $vid = [$vid]; } foreach ($vid as $item) { - if (!isset($vocabularies[$item])) { - $io->error("Invalid vid: {$item}."); - } $vocabulary = $vocabularies[$item]; $terms = $termStorage->loadTree($vocabulary->id()); - foreach ($terms as $term) { - $treal = $termStorage->load($term->tid); - if ($treal !== null) { - $io->info("Deleting '{$term->name}' and all translations."); - $treal->delete(); + if (empty($terms)) { + $io->error( + sprintf( + $this->trans('commands.taxonomy.term.delete.messages.nothing'), + $item + ) + ); + + } else { + foreach ($terms as $term) { + $treal = $termStorage->load($term->tid); + + if ($treal !== null) { + $io->info( + sprintf( + $this->trans('commands.taxonomy.term.delete.messages.processing'), + $term->name + ) + ); + $treal->delete(); + } } + } } } + + private function getVocabularies() + { + return $this->entityTypeManager->getStorage('taxonomy_vocabulary') + ->loadMultiple(); + } } diff --git a/src/Command/Test/RunCommand.php b/src/Command/Test/RunCommand.php index 0539ad0e6..492bb1e30 100644 --- a/src/Command/Test/RunCommand.php +++ b/src/Command/Test/RunCommand.php @@ -93,7 +93,7 @@ protected function configure() InputOption::VALUE_REQUIRED, $this->trans('commands.test.run.arguments.url') ) - ->setAliases(['tr']); + ->setAliases(['ter']); } /* diff --git a/src/Command/Theme/DownloadCommand.php b/src/Command/Theme/DownloadCommand.php index 315602701..0f01f2c37 100644 --- a/src/Command/Theme/DownloadCommand.php +++ b/src/Command/Theme/DownloadCommand.php @@ -82,7 +82,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.theme.download.options.composer') - )->setAliases(['td']); + )->setAliases(['thd']); } /** diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index 61d348ae6..77ce74796 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -71,7 +71,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.theme.install.options.set-default') - )->setAliases(['ti']); + )->setAliases(['thi']); } /** diff --git a/src/Command/Theme/PathCommand.php b/src/Command/Theme/PathCommand.php index 68ad53bd7..131c16525 100644 --- a/src/Command/Theme/PathCommand.php +++ b/src/Command/Theme/PathCommand.php @@ -14,27 +14,34 @@ use Symfony\Component\Console\Command\Command; use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Core\Extension\ThemeHandler; class PathCommand extends Command { use CommandTrait; - use ModuleTrait; + /** * @var Manager */ protected $extensionManager; + /** + * @var ThemeHandler + */ + protected $themeHandler; + /** * PathCommand constructor. * - * @param Manager $extensionManager + * @param Manager $extensionManager + * @param ThemeHandler $themeHandler */ - public function __construct(Manager $extensionManager) + public function __construct(Manager $extensionManager, ThemeHandler $themeHandler) { $this->extensionManager = $extensionManager; + $this->themeHandler = $themeHandler; parent::__construct(); } @@ -46,24 +53,32 @@ protected function configure() ->addArgument( 'theme', InputArgument::REQUIRED, - $this->trans('commands.theme.path.arguments.module') + $this->trans('commands.theme.path.arguments.theme') ) ->addOption( 'absolute', null, InputOption::VALUE_NONE, $this->trans('commands.theme.path.options.absolute') - ); + )->setAliases(['thp']); } protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $theme = $input->getArgument('theme'); $fullPath = $input->getOption('absolute'); + if (!in_array($theme, $this->getThemeList())) { + $io->error( + sprintf( + 'Invalid theme name: %s', + $theme + ) + ); + return; + } $theme = $this->extensionManager->getTheme($theme); $io->info( @@ -78,12 +93,19 @@ protected function interact(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - // --module argument + // --theme argument $theme = $input->getArgument('theme'); if (!$theme) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setArgument('theme', $module); + $theme = $io->choiceNoList( + $this->trans('commands.theme.path.arguments.theme'), + $this->getThemeList() + ); + $input->setArgument('theme', $theme); } } + + protected function getThemeList() + { + return array_keys($this->themeHandler->rebuildThemeData()); + } } diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index fdadd2cb8..f553b6df2 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -65,7 +65,7 @@ protected function configure() InputArgument::IS_ARRAY, $this->trans('commands.theme.uninstall.options.module') ) - ->setAliases(['tu']); + ->setAliases(['thu']); } /** diff --git a/src/Command/Update/EntitiesCommand.php b/src/Command/Update/EntitiesCommand.php index 85b5007a4..bf28b81f0 100644 --- a/src/Command/Update/EntitiesCommand.php +++ b/src/Command/Update/EntitiesCommand.php @@ -67,7 +67,9 @@ protected function configure() { $this ->setName('update:entities') - ->setDescription($this->trans('commands.update.entities.description')); + ->setDescription($this->trans('commands.update.entities.description')) + ->setAliases(['upe']); + ; } /** diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index 7181012ac..82d102f37 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -110,7 +110,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.update.execute.options.update-n') ) - ->setAliases(['upe']); + ->setAliases(['upex']); } /** diff --git a/src/Command/User/CreateCommand.php b/src/Command/User/CreateCommand.php index 0a5480e28..d1bd21d0d 100644 --- a/src/Command/User/CreateCommand.php +++ b/src/Command/User/CreateCommand.php @@ -103,7 +103,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.user.create.options.status') - ); + )->setAliases(['uc']); } /** diff --git a/src/Command/User/DeleteCommand.php b/src/Command/User/DeleteCommand.php index 3a4b88d25..0992e0d90 100644 --- a/src/Command/User/DeleteCommand.php +++ b/src/Command/User/DeleteCommand.php @@ -78,7 +78,7 @@ protected function configure() null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, $this->trans('commands.user.delete.options.roles') - ); + )->setAliases(['ud']); } /** diff --git a/src/Command/User/LoginCleanAttemptsCommand.php b/src/Command/User/LoginCleanAttemptsCommand.php index 3acf20e5e..434282321 100644 --- a/src/Command/User/LoginCleanAttemptsCommand.php +++ b/src/Command/User/LoginCleanAttemptsCommand.php @@ -52,7 +52,7 @@ protected function configure() InputArgument::REQUIRED, $this->trans('commands.user.login.clear.attempts.options.user-id') ) - ->setAliases(['uslca']); + ->setAliases(['ulca']); } /** diff --git a/src/Command/User/LoginUrlCommand.php b/src/Command/User/LoginUrlCommand.php index c164db46a..97d4e08fb 100644 --- a/src/Command/User/LoginUrlCommand.php +++ b/src/Command/User/LoginUrlCommand.php @@ -54,7 +54,7 @@ protected function configure() $this->trans('commands.user.login.url.options.user-id'), null ) - ->setAliases(['uslu']); + ->setAliases(['ulu']); } /** diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index 386b54ad5..bc9e62490 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -51,7 +51,7 @@ protected function configure() InputArgument::IS_ARRAY, $this->trans('commands.user.password.hash.options.password') ) - ->setAliases(['usph']); + ->setAliases(['uph']); } /** diff --git a/src/Command/User/PasswordResetCommand.php b/src/Command/User/PasswordResetCommand.php index 4ef5d620c..2eab398d5 100644 --- a/src/Command/User/PasswordResetCommand.php +++ b/src/Command/User/PasswordResetCommand.php @@ -66,7 +66,7 @@ protected function configure() InputArgument::REQUIRED, $this->trans('commands.user.password.reset.options.password') ) - ->setAliases(['uspr']); + ->setAliases(['upr']); } /** diff --git a/src/Command/User/RoleCommand.php b/src/Command/User/RoleCommand.php index d0cc19733..dbce8e411 100644 --- a/src/Command/User/RoleCommand.php +++ b/src/Command/User/RoleCommand.php @@ -62,7 +62,7 @@ protected function configure() 'role', InputOption::VALUE_REQUIRED, $this->trans('commands.user.role.role') - ); + )->setAliases(['ur']); } /** diff --git a/src/Command/Views/DisableCommand.php b/src/Command/Views/DisableCommand.php index 85a386e88..4a0dddcb1 100644 --- a/src/Command/Views/DisableCommand.php +++ b/src/Command/Views/DisableCommand.php @@ -63,7 +63,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.views.debug.arguments.view-id') ) - ->setAliases(['vdi']); + ->setAliases(['vd']); } /**