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.33k stars 1.08k forks source link

Port Drupal Console `config:export:single` so I can export config individually, instead of via the UI. #5621

Closed trackleft closed 1 year ago

trackleft commented 1 year ago

Is your feature request related to a problem? Please describe. As a distribution or test module maintainer, when I add new config to the install folder, I have to strip out site UUID and core version hash for each config file that I export in order to be installed on sites other than the one it was created in. config:export currently only "Export Drupal configuration to a directory." which exports the entire site's configuration to a directory.

With Drupal Console I am able to use config:export:single

Describe the solution you'd like I would love it if Drush had similar to Drupal Console for this task. Drupal Console, config:export:single help

image

https://github.com/hechoendrupal/drupal-console/blob/7027117c82cd8b9d9f3fb89558a088e0575434d3/src/Command/Config/ExportSingleCommand.php#L96

Describe alternatives you've considered Fork Drupal Console in order to keep this functionality when upgrading to Drupal 10.

weitzman commented 1 year ago

Done in #5146 and #5543

joeparsons commented 1 year ago

@weitzman Is exporting a single config item covered in #5543? I only saw docs about config import there.

weitzman commented 1 year ago

I'm inclined to skip this in favor of drush cget system.site > tmp.yml. Feel free to submit a Usage example in config:get help.

trackleft commented 1 year ago

The key missing feature of cget is that you can not optionally remove the uuid or the _core: default_config_hash: which would allow including config exported by drush in test modules for automated testing, or distributions that install and manage configuration over the lifetime of the site.

These two missing options make this a manual process for anyone submitting a pull request that includes configuration, unless I'm missing something.

Even the default install profiles within drupal core do not have uuid or _core: default_config_hash: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/profiles/standard/config/install/block_content.type.basic.yml