We need to add the ability using chain as extension for the DrupalConsole commands. This can be very help to extend the drupal list from the chain commands.
This is a nice way to easily integrate DC with other projects without need of writing any code or hacking DC to extend their functionality.
We can add two extra parameters to define the group and the command.
group-chain: bestgroup
command: bestcommand
chain-url: projectname/chain/chain-name.yml
Then in drupal list we are going to be able to see an extention like this
bestgroup:bestcommand
And the user will be able to type drupal bestgroup:bestcommand and it will simulate this drupal chain --file=~/drupal/modules/projectname/chain/chain-name.yml
@darol100 like the idea, is this kinda like drush shell aliases?
I'm not 100% sure if what is exactly you are referring too..
drush shell aliases
But Drush does something very similar, there are many contrib projects that carry drush command which is very handling because extend the functionality of the Drush commands. They have this hook hook_drush_command which allows you to define your own commands.
So the goal of this issue is to be able to write DC commands base of chain pre-config information that can be extend drupal list
Since we already wrote the auto-discovery of chain files on ~/.console/chain/ directory and actually is used on chain:debug command.

I re-use that discovery feature to added to chain when not --file option is passed by the user.

This is how the execution looks like:

Based on how the current configuration for commands is handled, we can add something like this to the YAML files in order to discover and register them as commands.
command:
name: casper:config
description: Import casper Manage Form and Manage Display configuration.
I merged the discovery feature on the interactive mode PR => https://github.com/hechoendrupal/DrupalConsole/pull/2068
It's a great improvement, I haven't check how [drupal:chain] is working right now, but it would be lovely if I could add a YAML file with my commands into my root project, then It will be able to be manage by control version, then discovering process gets smart enough to grab it and exposes it as an option while I execute chain command even chain:debug.
Perhaps, if we define another path to discover those commands into D8 installation, or remove "--file" parameter and define it as first argument. does it make sense?
CC: @jmolivas
@kenneth-bolivar-castro we got you covered, the chain command search for YAML files at:
~/.console/chain/path/to/d8.dev/console/chain//path/to/d8.dev/custom/module_name/console/chain//path/to/d8.dev/contrib/module_name/console/chain/Awesome! @jmolivas Drupal Console rocks! :+1:
@jmolivas I'm running Drupal Console version 0.11.2, I just added "console/chain" folder structure on my root project, also I rebuild all caches, however I can't see YAML file yet, am I missing anything?
@kenneth-bolivar-castro Yes try updating to 0.11.3 if you site is 8.0.x or 1.0.0-apha1 if your site is 8.1.x
@jmolivas looks like it isn't available yet,
$ drupal self-update
Checking for updates from version: 0.11.2
The latest version 0.11.2, was already installed on your system.
@kenneth-bolivar-castro try this instead
$ curl https://github.com/hechoendrupal/DrupalConsole/releases/download/0.11.3/drupal.phar -L -o drupal.phar
@jmolivas great! thx now it's up and running! :+1:
馃憤 on this feature
@darol100 if you're busy these days, i would like to contribute to this issue with some of my (few) time.
my problem is i have no idea on how to accomplish this. if you have some ideas to enlighten this task, please provide them to me. i will try to do my best.
This PR https://github.com/hechoendrupal/DrupalConsole/pull/2953 from @marcelovani address this.
Completed with this other PRs
https://github.com/hechoendrupal/drupal-console-core/pull/97
https://github.com/hechoendrupal/DrupalConsole/pull/2989
https://github.com/hechoendrupal/DrupalConsole/pull/2990
To make a chain file automatically registered as command this new block of meta-data should be added on to the file.
command:
name: site:setup
description: Setup site
Complete file
command:
name: site:setup
description: Setup site
commands:
- command: site:install
arguments:
profile: standard
options:
force: true
no-interaction: true
- command: cache:rebuild
arguments:
cache: all
cc: @darol100 @kenneth-bolivar-castro @novia713
w00T... Good work guys...
Most helpful comment
Completed with this other PRs
https://github.com/hechoendrupal/drupal-console-core/pull/97
https://github.com/hechoendrupal/DrupalConsole/pull/2989
https://github.com/hechoendrupal/DrupalConsole/pull/2990
To make a chain file automatically registered as command this new block of meta-data should be added on to the file.
Complete file