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:
- Output plugin id
- Collection name (to restrict the patch for certain collections)
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 3102448-drush-annotations-14.patch | 1.66 KB | a.dmitriiev |
| #12 | drush-config-namespace.patch | 770 bytes | ahebrank |
| #9 | 3102448-drush-command-line-interface-output-9.patch | 5.26 KB | a.dmitriiev |
| #5 | drush_command_3102448.patch | 3.3 KB | a.dmitriiev |
Comments
Comment #2
a.dmitriiev commentedComment #3
a.dmitriiev commentedI will also help with this issue once there will be a service from parent issue (or modified version, if you have more improvements).
Comment #4
ahebrank commentedComment #5
a.dmitriiev commentedHere 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).
Comment #6
a.dmitriiev commentedComment #7
ahebrank commentedThis 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.
Comment #8
a.dmitriiev commentedWe 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?
Comment #9
a.dmitriiev commentedHere 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.
Comment #11
ahebrank commentedComment #12
ahebrank commentedNow 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?
Comment #13
a.dmitriiev commentedI think it is ok to add to config namespace, I think the only restriction is that the name is unique
Comment #14
a.dmitriiev commentedI'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.
Comment #15
a.dmitriiev commentedComment #17
ahebrank commented