wp-cli.plugin.zsh 2.91 KB
Newer Older
Josh Medeski's avatar
Josh Medeski committed
1
2
# WP-CLI
# A command line interface for WordPress
Janosch Schwalm's avatar
Janosch Schwalm committed
3
# https://wp-cli.org/
Josh Medeski's avatar
Josh Medeski committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

# Core
alias wpcc='wp core config'
alias wpcd='wp core download'
alias wpci='wp core install'
alias wpcii='wp core is-installed'
alias wpcmc='wp core multisite-convert'
alias wpcmi='wp core multisite-install'
alias wpcu='wp core update'
alias wpcudb='wp core update-db'
alias wpcvc='wp core verify-checksums'

# Cron
alias wpcre='wp cron event'
alias wpcrs='wp cron schedule'
alias wpcrt='wp cron test'

# Db
22
23
24
25
26
27
alias wpdbe='wp db export'
alias wpdbi='wp db import'
alias wpdbcr='wp db create'
alias wpdbs='wp db search'
alias wpdbch='wp db check'
alias wpdbr='wp db repair'
Josh Medeski's avatar
Josh Medeski committed
28
29
30
31
32
33
34
35
36

# Menu
alias wpmc='wp menu create'
alias wpmd='wp menu delete'
alias wpmi='wp menu item'
alias wpml='wp menu list'
alias wpmlo='wp menu location'

# Plugin
Luis Martins's avatar
Luis Martins committed
37
38
39
40
41
42
43
44
45
46
47
alias wppa='wp plugin activate'
alias wppda='wp plugin deactivate'
alias wppd='wp plugin delete'
alias wppg='wp plugin get'
alias wppi='wp plugin install'
alias wppis='wp plugin is-installed'
alias wppl='wp plugin list'
alias wppp='wp plugin path'
alias wpps='wp plugin search'
alias wppst='wp plugin status'
alias wppt='wp plugin toggle'
Ahmad Awais's avatar
Ahmad Awais committed
48
alias wppun='wp plugin uninstall'
Luis Martins's avatar
Luis Martins committed
49
alias wppu='wp plugin update'
Josh Medeski's avatar
Josh Medeski committed
50
51
52
53
54
55
56
57
58
59

# Post
alias wppoc='wp post create'
alias wppod='wp post delete'
alias wppoe='wp post edit'
alias wppogen='wp post generate'
alias wppog='wp post get'
alias wppol='wp post list'
alias wppom='wp post meta'
alias wppou='wp post update'
Ahmad Awais's avatar
Ahmad Awais committed
60
alias wppourl='wp post url'
Josh Medeski's avatar
Josh Medeski committed
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

# Sidebar
alias wpsbl='wp sidebar list'

# Theme
alias wpta='wp theme activate'
alias wptd='wp theme delete'
alias wptdis='wp theme disable'
alias wpte='wp theme enable'
alias wptg='wp theme get'
alias wpti='wp theme install'
alias wptis='wp theme is-installed'
alias wptl='wp theme list'
alias wptm='wp theme mod'
alias wptp='wp theme path'
alias wpts='wp theme search'
alias wptst='wp theme status'
Rahil Wazir's avatar
Rahil Wazir committed
78
alias wptu='wp theme update'
Josh Medeski's avatar
Josh Medeski committed
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

# User
alias wpuac='wp user add-cap'
alias wpuar='wp user add-role'
alias wpuc='wp user create'
alias wpud='wp user delete'
alias wpugen='wp user generate'
alias wpug='wp user get'
alias wpui='wp user import-csv'
alias wpul='wp user list'
alias wpulc='wp user list-caps'
alias wpum='wp user meta'
alias wpurc='wp user remove-cap'
alias wpurr='wp user remove-role'
alias wpusr='wp user set-role'
alias wpuu='wp user update'

# Widget
alias wpwa='wp widget add'
alias wpwda='wp widget deactivate'
alias wpwd='wp widget delete'
alias wpwl='wp widget list'
alias wpwm='wp widget move'
alias wpwu='wp widget update'
103
104


105
# Completion for wp
106
autoload -U +X bashcompinit && bashcompinit
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
_wp_complete() {
	local cur=${COMP_WORDS[COMP_CWORD]}

	IFS=$'\n';  # want to preserve spaces at the end
	local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"

	if [[ "$opts" =~ \<file\>\s* ]]
	then
		COMPREPLY=( $(compgen -f -- $cur) )
	elif [[ $opts = "" ]]
	then
		COMPREPLY=( $(compgen -f -- $cur) )
	else
		COMPREPLY=( ${opts[*]} )
	fi
}
complete -o nospace -F _wp_complete wp