{"action":"closed","issue":{"url":"https://api.github.com/repos/hechoendrupal/DrupalAppConsole/issues/516","labels_url":"https://api.github.com/repos/hechoendrupal/DrupalAppConsole/issues/516/labels{/name}","comments_url":"https://api.github.com/repos/hechoendrupal/DrupalAppConsole/issues/516/comments","events_url":"https://api.github.com/repos/hechoendrupal/DrupalAppConsole/issues/516/events","html_url":"https://github.com/hechoendrupal/DrupalAppConsole/issues/516","id":62802545,"number":516,"title":"[chain] Chain commands execution","user":{"login":"jmolivas","id":366275,"avatar_url":"https://avatars.githubusercontent.com/u/366275?v=3","gravatar_id":"","url":"https://api.github.com/users/jmolivas","html_url":"https://github.com/jmolivas","followers_url":"https://api.github.com/users/jmolivas/followers","following_url":"https://api.github.com/users/jmolivas/following{/other_user}","gists_url":"https://api.github.com/users/jmolivas/gists{/gist_id}","starred_url":"https://api.github.com/users/jmolivas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmolivas/subscriptions","organizations_url":"https://api.github.com/users/jmolivas/orgs","repos_url":"https://api.github.com/users/jmolivas/repos","events_url":"https://api.github.com/users/jmolivas/events{/privacy}","received_events_url":"https://api.github.com/users/jmolivas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hechoendrupal/DrupalAppConsole/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/hechoendrupal/DrupalAppConsole/labels/fixed","name":"fixed","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-18T21:14:04Z","updated_at":"2015-04-02T18:53:44Z","closed_at":"2015-04-02T18:53:44Z","body":"Taking advantage of this feature Add chain command Helper https://github.com/hechoendrupal/DrupalAppConsole/pull/512  the idea of this is adding a new command that can execute diff commands based on:\r\n\r\n* Calling commands by name and take info from defaults see issue https://github.com/hechoendrupal/DrupalAppConsole/issues/515\r\n  $ drupal chain --commands=generate:module, generate:controller\r\n\r\n* Reading from a YAML manifest file. \r\n  $ drupal chain --manifest=PATH_TO_MANIFEST_FILE.yml\r\n\r\nI wrote a prototype command, this command executes the `generate:module` & `generate:controller`:\r\n```\r\n<?php\r\n/**\r\n * @file\r\n * Contains \\Drupal\\AppConsole\\Command\\GeneratorExamplesCommand.\r\n */\r\nnamespace Drupal\\AppConsole\\Command;\r\n\r\nuse Symfony\\Component\\Console\\Input\\InputInterface;\r\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\r\nuse Symfony\\Component\\Console\\Input\\InputOption;\r\n\r\nclass GeneratorExamplesCommand extends ContainerAwareCommand\r\n{\r\n    /**\r\n     * {@inheritdoc}\r\n     */\r\n    protected function configure()\r\n    {\r\n        $this\r\n          ->setName('generate:examples')\r\n          ->setDescription($this->trans('commands.generate.example.description'))\r\n        ;\r\n    }\r\n\r\n    /**\r\n     * {@inheritdoc}\r\n     */\r\n    protected function execute(InputInterface $input, OutputInterface $output)\r\n    {\r\n        $generateModuleInputs = [\r\n          '--module' => 'Example module',\r\n          '--machine-name' => 'example',\r\n          '--module-path' => DRUPAL_ROOT . '/modules/custom/',\r\n          '--description' => 'My example module',\r\n          '--core' => '8.x',\r\n          '--package' => 'Test',\r\n          '--test' => false,\r\n          '--controller' => false,\r\n        ];\r\n\r\n        $this->getHelper('chain')->addCommand('generate:module', $generateModuleInputs);\r\n\r\n        $generateControllerInputs = [\r\n          '--module' => 'example',\r\n          '--class-name' => 'ExampleController',\r\n          '--method-name' => 'index',\r\n          '--route'=>'/index',\r\n          '--services' => 'twig',\r\n        ];\r\n\r\n        $this->getHelper('chain')->addCommand('generate:controller', $generateControllerInputs);\r\n    }\r\n}\r\n\r\n``` \r\nAnd this is the result of executing it:\r\n![console-generate-examples](https://cloud.githubusercontent.com/assets/366275/6719487/2eccb852-cd78-11e4-8451-0eee2999455b.gif)"}}