Improve drush command options and names

Created on 11 April 2025, 13 days ago

Problem/Motivation

The drush command uses dashes for the name and the options:

 $ drush image_derivatives:generate  --help
Generate all derivatives for all image styles.

Options:
 --image_styles[=IMAGE_STYLES] Coma separated image styles IDs.                      
 --skip_existing               Option to skip generating existing derivative images. 

Global options:
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 
-y, --yes            Auto-accept the default for all user prompts. Equivalent to --no-interaction.                      
-l, --uri=URI        A base URL for building links and selecting a multi-site. Defaults to https://default.             
                     To see all global options, run `drush topic` and pick the first choice.   

Usually, dashes are used, so this should be:

$ drush image-derivatives:generate  --help
Generate all derivatives for all image styles.

Options:
 --image-styles[=IMAGE_STYLES] Coma separated image styles IDs.                      
 --skip-existing               Option to skip generating existing derivative images. 

[...]

Steps to reproduce

Run drush image_derivatives:generate --help

Proposed resolution

Use dashses. This implies breaking any scripts using this command. I would:

  • Accept options with dashes and underscores,
  • Declare an a alias using underscore and move main command name to use dash
  • Emit a warning when the command is used with underscores. In next major version we can drop underscore support.

Remaining tasks

Patch pending.

User interface changes

Commands will use dashes instead of underscores.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Created by

🇪🇸Spain tunic Madrid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024