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

--diff as default for drush config:import via Drush configuration #4901

Closed gitressa closed 2 years ago

gitressa commented 2 years ago

Describe the bug According to the documentation, it should be possible to define defaults via a configuration file: https://www.drush.org/latest/using-drush-configuration/

What are you attempting to do

When running drush config:import I want --diff enabled by default, defined via my Drush configuration, as outlined in the examples under Command-specific options.

To Reproduce

I tried with this in vendor/drush/drush/drush.yml, and the uri is succesfully getting picked up, but not the diff-bit ... Do I need to use another syntax?

# Global options.
options:
  # Specify the base_url that should be used when generating links.
  uri: 'https://DRUSH-file-test.com/'

# Command-specific options.
command:
  config:
    import:
      options:
        diff: true

Under Environment variables I also see this:

An alternative way to populate Drush configuration is to define environment variables that correspond to config keys. For example, to populate the options.uri config item, create an environment variable DRUSH_OPTIONSURI=http://example.com. As you can see, variable names should be uppercased, prefixed with DRUSH, and periods replaced with dashes.

So something like this should work (DRUSH_OPTIONS_URI is getting picked up) in .lando.yml, but it doesn't:

services:
  appserver:
    overrides:
      environment:
        DRUSH_OPTIONS_URI: "https://DRUSH-lando-test.com/"
        DRUSH_COMMAND_CONFIG_IMPORT_OPTIONS_DIFF: "true"

Expected behavior I expected a detailed --diff-view after running drush config:import.

Actual behavior I got the ordinar list of files about to be changed, not the code changes.

System Configuration

Q A
Drush version? 10.6.1
Drupal version? 9.4.0-dev
PHP version 7.4.25
OS Ubuntu 20.04
Dev env. Lando 3.4.2
weitzman commented 2 years ago

I have some memory of this not working for boolean options. Could use verification and more caveats in docs.

weitzman commented 2 years ago

Dupe of #2956.

gitressa commented 2 years ago

Thanks, I'll subscribe to that issue and follow along.