style(drush): fix code and README style

This commit is contained in:
Marc Cornellà 2021-12-28 17:49:41 +01:00
parent c4be9294f2
commit 01230fa6e2
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B
2 changed files with 86 additions and 112 deletions

View file

@ -1,83 +1,60 @@
# Drush
## Description
This plugin offers aliases and functions to make the work with drush easier and more productive.
This plugin adds aliases and functions for [Drush](https://www.drush.org), a command-line shell
and Unix scripting interface for Drupal. It also adds completion for the `drush` command.
To enable it, add the `drush` to your `plugins` array in `~/.zshrc`:
To enable it, add `drush` to the plugins array in zshrc file:
```
```zsh
plugins=(... drush)
```
## Aliases
| Alias | Description | Command |
|-------|-----------------------------------------------------------------------|-----------------------------|
| dr | Display drush help | drush |
| drca | Clear all drupal caches. | drush cc all |
| drcb | Clear block cache. | drush cc block |
| drcg | Clear registry cache. | drush cc registry |
| drcj | Clear css-js cache. | drush cc css-js |
| drcm | Clear menu cache. | drush cc menu |
| drcml | Clear module-list cache. | drush cc module-list |
| drcr | Run all cron hooks in all active modules for specified site. | drush core-cron |
| drct | Clear theme-registry cache. | drush cc theme-registry |
| drcv | Clear views cache. (Make sure that the views module is enabled) | drush cc views |
| drdmp | Backup database in a new dump.sql file | drush drush sql-dump --ordered-dump --result-file=dump.sql|
| drf | Display features status | drush features |
| drfr | Revert a feature module on your site. | drush features-revert -y |
| drfu | Update a feature module on your site. | drush features-update -y |
| drfra | Revert all enabled feature module on your site. | drush features-revert-all |
| drif | Flush all derived images. | drush image-flush --all |
| drpm | Show a list of available modules. | drush pm-list --type=module |
| drst | Provides a birds-eye view of the current Drupal installation, if any. | drush core-status |
| drup | Apply any database updates required (as with running update.php). | drush updatedb |
| drups | List any pending database updates. | drush updatedb-status |
| drv | Show drush version. | drush version |
| drvd | Delete a variable. | drush variable-del |
| drvg | Get a list of some or all site variables and values. | drush variable-get |
| drvs | Set a variable. | drush variable-set |
| Alias | Command | Description |
| ------- | ------------------------------------------------------------ | --------------------------------------------------------------------- |
| `dr` | `drush` | Display drush help |
| `drca` | `drush cc all` | _(Deprecated in Drush 8)_ Clear all drupal caches. |
| `drcb` | `drush cc block` | _(Deprecated in Drush 8)_ Clear block cache. |
| `drcg` | `drush cc registry` | _(Deprecated in Drush 8)_ Clear registry cache. |
| `drcj` | `drush cc css-js` | Clear css-js cache. |
| `drcm` | `drush cc menu` | Clear menu cache. |
| `drcml` | `drush cc module-list` | Clear module-list cache. |
| `drcr` | `drush core-cron` | Run all cron hooks in all active modules for specified site. |
| `drct` | `drush cc theme-registry` | Clear theme-registry cache. |
| `drcv` | `drush cc views` | Clear views cache. (Make sure that the views module is enabled) |
| `drdmp` | `drush drush sql-dump --ordered-dump --result-file=dump.sql` | Backup database in a new dump.sql file |
| `drf` | `drush features` | Display features status |
| `drfr` | `drush features-revert -y` | Revert a feature module on your site. |
| `drfra` | `drush features-revert-all` | Revert all enabled feature module on your site. |
| `drfu` | `drush features-update -y` | Update a feature module on your site. |
| `drif` | `drush image-flush --all` | Flush all derived images. |
| `drpm` | `drush pm-list --type=module` | Show a list of available modules. |
| `drst` | `drush core-status` | Provides a birds-eye view of the current Drupal installation, if any. |
| `drup` | `drush updatedb` | Apply any database updates required (as with running update.php). |
| `drups` | `drush updatedb-status` | List any pending database updates. |
| `drv` | `drush version` | Show drush version. |
| `drvd` | `drush variable-del` | Delete a variable. |
| `drvg` | `drush variable-get` | Get a list of some or all site variables and values. |
| `drvs` | `drush variable-set` | Set a variable. |
## Functions
### dren
Download and enable one or more extensions (modules or themes).
Must be invoked with one or more parameters. e.g.:
`dren devel` or `dren devel module_filter views`
- `dren`: download and enable one or more extensions (modules or themes). Must be
invoked with one or more parameters, e.g.: `dren devel` or `dren devel module_filter views`.
### drf
Edit drushrc, site alias, and Drupal settings.php files.
Can be invoked with one or without parameters. e.g.:
`drf 1`
- `drf`: edit drushrc, site alias, and Drupal settings.php files.
Can be invoked with one or without parameters, e.g.: `drf 1`.
### dris
Disable one or more extensions (modules or themes)
Must be invoked with one or more parameters. e.g.:
`dris devel` or `dris devel module_filter views`
- `dris`: disable one or more extensions (modules or themes). Must be invoked with
one or more parameters, e.g.: `dris devel` or `dris devel module_filter views`.
### drpu
Uninstall one or more modules.
Must be invoked with one or more parameters. e.g.:
`drpu devel` or `drpu devel module_filter views`
- `drpu`: uninstall one or more modules. Must be invoked with one or more
parameters, e.g.: `drpu devel` or `drpu devel module_filter views`.
### drnew
Creates a brand new drupal website.
Note: As soon as the installation is complete, drush will print a username and a random password into the terminal:
```
Installation complete. User name: admin User password: cf7t8yqNEm
```
- `drnew`: creates a brand new drupal website. Note: as soon as the installation
is complete, `drush` will print a username and a random password into the terminal:
## Additional features
### Autocomplete
The [completion script for drush](https://github.com/drush-ops/drush/blob/8.0.1/drush.complete.sh) comes enabled with this plugin.
So, it is possible to type a command:
```
drush sql
```
And as soon as the tab key is pressed, the script will display the available commands:
```
drush sql
sqlc sql-conf sql-create sql-dump sql-query sql-sanitize
sql-cli sql-connect sql-drop sqlq sqlsan sql-sync
```
```text
Installation complete. User name: admin User password: cf7t8yqNEm
```

View file

@ -1,19 +1,18 @@
# Drush support.
# Functions
function dren() {
drush en $@ -y
drush en "$@" -y
}
function dris() {
drush pm-disable $@ -y
drush pm-disable "$@" -y
}
function drpu() {
drush pm-uninstall $@ -y
drush pm-uninstall "$@" -y
}
function drf() {
if [[ $1 == "" ]] then
if [[ -z "$1" ]] then
drush core-config
else
drush core-config --choice=$1
@ -21,18 +20,16 @@ function drf() {
}
function drfi() {
if [[ $1 == "fields" ]]; then
drush field-info fields
elif [[ $1 == "types" ]]; then
drush field-info types
else
drush field-info
fi
case "$1" in
fields) drush field-info fields ;;
types) drush field-info types ;;
*) drush field-info ;;
esac
}
function drnew() {
cd ~
(
cd
echo "Website's name: "
read WEBSITE_NAME
@ -69,10 +66,10 @@ function drnew() {
open_command $HOST$WEBSITE_NAME
echo "Done"
)
}
# Aliases, sorted alphabetically.
# Aliases
alias dr="drush"
alias drca="drush cc all" # Deprecated for Drush 8
alias drcb="drush cc block" # Deprecated for Drush 8
@ -86,8 +83,8 @@ alias drcv="drush cc views"
alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql"
alias drf="drush features"
alias drfr="drush features-revert -y"
alias drfu="drush features-update -y"
alias drfra="drush features-revert-all"
alias drfu="drush features-update -y"
alias drif="drush image-flush --all"
alias drpm="drush pm-list --type=module"
alias drst="drush core-status"