drush.plugin.zsh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # Drush support.
  2. function dren() {
  3. drush en $@ -y
  4. }
  5. function dris() {
  6. drush pm-disable $@ -y
  7. }
  8. function drpu() {
  9. drush pm-uninstall $@ -y
  10. }
  11. function drf() {
  12. if [[ $1 == "" ]] then
  13. drush core-config
  14. else
  15. drush core-config --choice=$1
  16. fi
  17. }
  18. function drfi() {
  19. if [[ $1 == "fields" ]]; then
  20. drush field-info fields
  21. elif [[ $1 == "types" ]]; then
  22. drush field-info types
  23. else
  24. drush field-info
  25. fi
  26. }
  27. function drnew() {
  28. cd ~
  29. echo "Website's name: "
  30. read WEBSITE_NAME
  31. HOST=http://$(hostname -i)/
  32. if [[ $WEBSITE_NAME == "" ]] then
  33. MINUTES=$(date +%M:%S)
  34. WEBSITE_NAME="Drupal-$MINUTES"
  35. echo "Your website will be named: $WEBSITE_NAME"
  36. fi
  37. drush dl drupal --drupal-project-rename=$WEBSITE_NAME
  38. echo "Type your localhost directory: (Leave empty for /var/www/html/)"
  39. read DIRECTORY
  40. if [[ $DIRECTORY == "" ]] then
  41. DIRECTORY="/var/www/html/"
  42. fi
  43. echo "Moving to $DIRECTORY$WEBSITE_NAME"
  44. sudo mv $WEBSITE_NAME $DIRECTORY
  45. cd $DIRECTORY$WEBSITE_NAME
  46. echo "Database's user: "
  47. read DATABASE_USR
  48. echo "Database's password: "
  49. read -s DATABASE_PWD
  50. echo "Database's name for your project: "
  51. read DATABASE
  52. DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE"
  53. drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME
  54. open_command $HOST$WEBSITE_NAME
  55. echo "Done"
  56. }
  57. # Aliases, sorted alphabetically.
  58. alias dr="drush"
  59. alias drca="drush cc all" # Deprecated for Drush 8
  60. alias drcb="drush cc block" # Deprecated for Drush 8
  61. alias drcg="drush cc registry" # Deprecated for Drush 8
  62. alias drcj="drush cc css-js"
  63. alias drcm="drush cc menu"
  64. alias drcml="drush cc module-list"
  65. alias drcr="drush core-cron"
  66. alias drct="drush cc theme-registry"
  67. alias drcv="drush cc views"
  68. alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql"
  69. alias drf="drush features"
  70. alias drfr="drush features-revert -y"
  71. alias drfu="drush features-update -y"
  72. alias drfra="drush features-revert-all"
  73. alias drif="drush image-flush --all"
  74. alias drpm="drush pm-list --type=module"
  75. alias drst="drush core-status"
  76. alias drup="drush updatedb"
  77. alias drups="drush updatedb-status"
  78. alias drv="drush version"
  79. alias drvd="drush variable-del"
  80. alias drvg="drush variable-get"
  81. alias drvs="drush variable-set"
  82. # Enable drush autocomplete support
  83. autoload bashcompinit
  84. bashcompinit
  85. source $(dirname $0)/drush.complete.sh