drush-ops / drush

Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.
https://www.drush.org
2.34k stars 1.08k forks source link

Port the `config-list` command to Drush 9 #3005

Closed pfrenssen closed 7 years ago

pfrenssen commented 7 years ago

The config-list command is not available in Drush 9 and it is sorely missed. The config-get command now outputs an interactive list but I didn't find a way to print this to the terminal non-interactively like config-list was able to do.

I have two use cases that are no longer possible now:

We are developing a distribution and store all of our config in custom modules. I was using a script that does a diff of the list of config on my local environment with a diff on my reference environment to check that I didn't forget to export any new config to modules. This script relies on config-list and will no longer work once we move to Drupal 8.4 + Drush 9.

Secondly, I am very much UNIX / command line oriented so I am used to piping the output of commands and string them together to do useful stuff. One thing I do at least once per day which is no longer possible in Drush 9 is to output the list of newly created config to a module info file for using with the Config Devel module. For example if I create a field with the machine name field_my_field_name then it generates a bunch of config files, and I used to be able to dump them in the info file with a simple UNIX command chain:

$ drush cli | grep field_my_field_name >> ./path/to/module.info.yml

On our Drush 9 branch it is not clear how I can get a list of config items that are related to the field name.

weitzman commented 7 years ago

Thanks for using Drush9! ... Those are two pretty good just justifications. If anyone is able to make a PR, I'll review and merge.

greg-1-anderson commented 7 years ago

Maybe this is a little off-topic, since this has been a thing for a while now; however, it seems a bit odd to me that the cli shortcut is neither core:cli nor sql:cli, but instead is a command that has nothing to do with a command line interface. Would it be a problem to support config:list, config-list and clst, and drop cli in Drush 9?

greg-1-anderson commented 7 years ago

(Or cls)

weitzman commented 7 years ago

I had that thought too. go with clst.

pfrenssen commented 7 years ago

For me personally it's no problem, the script I am using is just for my own use and I can adapt it.

I have also considered this before that drush cli is perhaps not the best shortcut for it. At the moment it is ingrained in my muscle memory though :)

I always thought drush cli should be the a synonym for drush php.

pfrenssen commented 7 years ago

This is fixed by #3026, thanks @Chi-teck for implementing it!

DavideBruner commented 6 years ago

You can try typing drush config:get or drush cget, it should work.

MatthieuScarset commented 6 years ago

How do we add this command to the documentation?

The actual working command is now drush cst and it's missing from this page: https://drushcommands.com/drush-9x/config/

Chi-teck commented 6 years ago

@MatthieuScarset, I think drushcommands.com is a third party site.