wp-cli.plugin.zsh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # WP-CLI
  2. # A command line interface for WordPress
  3. # https://wp-cli.org/
  4. # Core
  5. alias wpcc='wp core config'
  6. alias wpcd='wp core download'
  7. alias wpci='wp core install'
  8. alias wpcii='wp core is-installed'
  9. alias wpcmc='wp core multisite-convert'
  10. alias wpcmi='wp core multisite-install'
  11. alias wpcu='wp core update'
  12. alias wpcudb='wp core update-db'
  13. alias wpcvc='wp core verify-checksums'
  14. # Cron
  15. alias wpcre='wp cron event'
  16. alias wpcrs='wp cron schedule'
  17. alias wpcrt='wp cron test'
  18. # Db
  19. alias wpdbe='wp db export'
  20. alias wpdbi='wp db import'
  21. alias wpdbcr='wp db create'
  22. alias wpdbs='wp db search'
  23. alias wpdbch='wp db check'
  24. alias wpdbr='wp db repair'
  25. # Menu
  26. alias wpmc='wp menu create'
  27. alias wpmd='wp menu delete'
  28. alias wpmi='wp menu item'
  29. alias wpml='wp menu list'
  30. alias wpmlo='wp menu location'
  31. # Plugin
  32. alias wppa='wp plugin activate'
  33. alias wppda='wp plugin deactivate'
  34. alias wppd='wp plugin delete'
  35. alias wppg='wp plugin get'
  36. alias wppi='wp plugin install'
  37. alias wppis='wp plugin is-installed'
  38. alias wppl='wp plugin list'
  39. alias wppp='wp plugin path'
  40. alias wpps='wp plugin search'
  41. alias wppst='wp plugin status'
  42. alias wppt='wp plugin toggle'
  43. alias wppun='wp plugin uninstall'
  44. alias wppu='wp plugin update'
  45. # Post
  46. alias wppoc='wp post create'
  47. alias wppod='wp post delete'
  48. alias wppoe='wp post edit'
  49. alias wppogen='wp post generate'
  50. alias wppog='wp post get'
  51. alias wppol='wp post list'
  52. alias wppom='wp post meta'
  53. alias wppou='wp post update'
  54. alias wppourl='wp post url'
  55. # Sidebar
  56. alias wpsbl='wp sidebar list'
  57. # Theme
  58. alias wpta='wp theme activate'
  59. alias wptd='wp theme delete'
  60. alias wptdis='wp theme disable'
  61. alias wpte='wp theme enable'
  62. alias wptg='wp theme get'
  63. alias wpti='wp theme install'
  64. alias wptis='wp theme is-installed'
  65. alias wptl='wp theme list'
  66. alias wptm='wp theme mod'
  67. alias wptp='wp theme path'
  68. alias wpts='wp theme search'
  69. alias wptst='wp theme status'
  70. alias wptu='wp theme update'
  71. # User
  72. alias wpuac='wp user add-cap'
  73. alias wpuar='wp user add-role'
  74. alias wpuc='wp user create'
  75. alias wpud='wp user delete'
  76. alias wpugen='wp user generate'
  77. alias wpug='wp user get'
  78. alias wpui='wp user import-csv'
  79. alias wpul='wp user list'
  80. alias wpulc='wp user list-caps'
  81. alias wpum='wp user meta'
  82. alias wpurc='wp user remove-cap'
  83. alias wpurr='wp user remove-role'
  84. alias wpusr='wp user set-role'
  85. alias wpuu='wp user update'
  86. # Widget
  87. alias wpwa='wp widget add'
  88. alias wpwda='wp widget deactivate'
  89. alias wpwd='wp widget delete'
  90. alias wpwl='wp widget list'
  91. alias wpwm='wp widget move'
  92. alias wpwu='wp widget update'
  93. # Completion for wp
  94. autoload -U +X bashcompinit && bashcompinit
  95. _wp_complete() {
  96. local cur=${COMP_WORDS[COMP_CWORD]}
  97. IFS=$'\n'; # want to preserve spaces at the end
  98. local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"
  99. if [[ "$opts" =~ \<file\>\s* ]]
  100. then
  101. COMPREPLY=( $(compgen -f -- $cur) )
  102. elif [[ $opts = "" ]]
  103. then
  104. COMPREPLY=( $(compgen -f -- $cur) )
  105. else
  106. COMPREPLY=( ${opts[*]} )
  107. fi
  108. }
  109. complete -o nospace -F _wp_complete wp