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

Default value from config is not set for dynamically added option #5679

Open DieterHolvoet opened 1 year ago

DieterHolvoet commented 1 year ago

Describe the bug I have a command option, default-language, which is dynamically added using $command->addOption(). I'm setting the default value for this option in a config file, but it is not being picked up when using Drush 12.

To Reproduce Install the entity_bundle_scaffold and taxonomy modules. Apply #3367659 as patch to entity_bundle_scaffold.

Add the following config file to your project:

# /drush/drush.yml
command:
    vocabulary:
        create:
            options:
                default-language: site_default

Run drush vocabulary:create.

Expected behavior The command doesn't prompt for the Default language since it already has the default value.

Actual behavior The command will prompt for the Default language, while it should already have the default value. This doesn't happen when using Drush 11.

Workaround /

System Configuration

Q A
Drush version? 12.1.0
Drupal version? 10.1.0
PHP version 8.1
OS? Mac

Additional information /

damienmckenna commented 1 week ago

I'm hitting a problem with Drush 13.3.0.0 where the contents of drush/drush.yml aren't used when running sql-dump. The contents are:

command:
  sql:
    dump:
      options:
        gzip: true
        structure-tables-key: common
sql:
  structure-tables:
    common:
      - cache
      - 'cache_*'
      - 'sessions'

When the sql-dump command runs it ignores the options and instead of saving a gzip file with a backup that excludes data from the tables above, it creates an SQL file that includes all data.