-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdrupal.plugin.zsh
75 lines (64 loc) · 1.6 KB
/
drupal.plugin.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# find and cd to drupal root folder
function droot() {
dir=.
until [ $dir -ef / ]; do
if [ -d "$dir/web" ]; then
cd "$dir"
return 0
fi
dir+=/..
done
echo "root folder not found"
return 1
}
# cd to the active theme path
function dtheme() {
root=`drush ev "echo DRUPAL_ROOT"`
if [ $? -eq 0 ]; then
cd "$root"
theme_path=`drush ev "echo \Drupal::theme()->getActiveTheme()->getPath()"`
cd "$theme_path"
return 0
else
echo "drush cant be used from this folder"
return 1
fi
}
# cd to current site folder
function dsite() {
root=`drush ev "echo DRUPAL_ROOT"`
if [ $? -eq 0]; then
cd "$root"
site_path=`drush ev "echo \Drupal::service('kernel')->getSitePath()"`
cd "$site_path"
return 0
else
echo "drush cant be used from this folder"
return 1
fi
}
# aliases
alias dcr='drush cache:rebuild'
alias dcc='drush cache:clear'
alias den='drush en'
alias dpmu='drush pmu'
alias dre='drush dre'
alias dcex='drush config:export'
alias dcim='drush config:import'
alias dcget='drush config:get'
alias dcset='drush config:set'
alias dcedit='drush config:edit'
alias dup='drush updatedb'
alias dco='composer outdated "drupal/*"'
alias dcur='composer update drupal/core "drupal/core-*" --with-all-dependencies' #with drupal-core-recommended
alias dcu='composer update drupal/core --with-dependencies'
# autocomplete
compdef _drush_add_completion drush
function _drush_add_completion() {
if [ -x "$(command -v drush)" ]; then
compadd `_drush_get_command_list`
fi
}
function _drush_get_command_list() {
drush list --raw | awk '{print $1}'
}