As a follow up to this issue https://www.drupal.org/project/config_patch/issues/3102075, when there is a service for patch generation it would be possible to create drush and drupal console commands.

For the first version it is enough to have 2 arguments:

  1. Output plugin id
  2. Collection name (to restrict the patch for certain collections)

Comments

a.dmitriiev created an issue. See original summary.

a.dmitriiev’s picture

a.dmitriiev’s picture

I will also help with this issue once there will be a service from parent issue (or modified version, if you have more improvements).

ahebrank’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
a.dmitriiev’s picture

StatusFileSize
new3.3 KB

Here is the basic drush command that has output plugin as an argument and two options: --filename and --collections to pass the name of the future patch and restriction by collections (comma separated list).

a.dmitriiev’s picture

Status: Active » Needs review
ahebrank’s picture

This will depend on https://www.drupal.org/project/config_patch/issues/3103313, but I wonder if plugins needs some kind of flag to indicate whether their response should be a string or a http response.

a.dmitriiev’s picture

We can add an Annotation property, but for some plugins like "Text" I think it could be both, because it should be possible within the form and with drush to export to file. Maybe we can add another interface, like CommandLineInterface and add outputCli() method? And the plugins that can provide the cli output will implement it and in drush command outputCli method will be called, not output? What do you think?

a.dmitriiev’s picture

Here is another patch with CliOutputPluginInterface. This way we can really separate the output from form and command line output. Also if some plugins really depend on form_state and can not be used in CLI they will not implement the new interface and will not have the method outputCli that is used in drush command.

  • ahebrank committed 7ab5e50 on 8.x-2.x authored by a.dmitriiev
    Issue #3102448 by a.dmitriiev: Create drush/drupal console command to...
ahebrank’s picture

Status: Needs review » Fixed
ahebrank’s picture

StatusFileSize
new770 bytes

Now I'm wondering if this would be easier to find in the drush config: namespace. Is that allowed in drush conventions, or are contrib commands supposed to all go in the global section?

a.dmitriiev’s picture

I think it is ok to add to config namespace, I think the only restriction is that the name is unique

a.dmitriiev’s picture

StatusFileSize
new1.66 KB

I've updated patch from #12 to add the options to outpuCli(), so the output plugins can read from options. Also I tested config: namespace and it is working properly.

To add your own new option this technique https://github.com/consolidation/annotated-command#option-event-hook could be used in other modules to enlarge the list of options.

a.dmitriiev’s picture

Status: Fixed » Needs review

  • ahebrank committed 87c4769 on 8.x-2.x authored by a.dmitriiev
    Issue #3102448 by a.dmitriiev: Create drush/drupal console command to...
ahebrank’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.