drush.plugin.zsh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Functions
  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 [[ -z "$1" ]] then
  13. drush core-config
  14. else
  15. drush core-config --choice=$1
  16. fi
  17. }
  18. function drfi() {
  19. case "$1" in
  20. fields) drush field-info fields ;;
  21. types) drush field-info types ;;
  22. *) drush field-info ;;
  23. esac
  24. }
  25. function drnew() {
  26. (
  27. cd
  28. echo "Website's name: "
  29. read WEBSITE_NAME
  30. HOST=http://$(hostname -i)/
  31. if [[ $WEBSITE_NAME == "" ]] then
  32. MINUTES=$(date +%M:%S)
  33. WEBSITE_NAME="Drupal-$MINUTES"
  34. echo "Your website will be named: $WEBSITE_NAME"
  35. fi
  36. drush dl drupal --drupal-project-rename=$WEBSITE_NAME
  37. echo "Type your localhost directory: (Leave empty for /var/www/html/)"
  38. read DIRECTORY
  39. if [[ $DIRECTORY == "" ]] then
  40. DIRECTORY="/var/www/html/"
  41. fi
  42. echo "Moving to $DIRECTORY$WEBSITE_NAME"
  43. sudo mv $WEBSITE_NAME $DIRECTORY
  44. cd $DIRECTORY$WEBSITE_NAME
  45. echo "Database's user: "
  46. read DATABASE_USR
  47. echo "Database's password: "
  48. read -s DATABASE_PWD
  49. echo "Database's name for your project: "
  50. read DATABASE
  51. DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE"
  52. drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME
  53. open_command $HOST$WEBSITE_NAME
  54. echo "Done"
  55. )
  56. }
  57. # Aliases
  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 drcex="drush config:export -y"
  62. alias drcg="drush cc registry" # Deprecated for Drush 8
  63. alias drcim="drush config:import -y"
  64. alias drcj="drush cc css-js"
  65. alias drcm="drush cc menu"
  66. alias drcml="drush cc module-list"
  67. alias drcr="drush core-cron"
  68. alias drct="drush cc theme-registry"
  69. alias drcv="drush cc views"
  70. alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql"
  71. alias drf="drush features"
  72. alias drfr="drush features-revert -y"
  73. alias drfra="drush features-revert-all"
  74. alias drfu="drush features-update -y"
  75. alias drif="drush image-flush --all"
  76. alias drpm="drush pm-list --type=module"
  77. alias drst="drush core-status"
  78. alias druli="drush user:login"
  79. alias drup="drush updatedb"
  80. alias drups="drush updatedb-status"
  81. alias drv="drush version"
  82. alias drvd="drush variable-del"
  83. alias drvg="drush variable-get"
  84. alias drvs="drush variable-set"
  85. alias drws="drush watchdog:show"
  86. alias drwse="drush watchdog:show --extended"
  87. alias drwst="drush watchdog:tail"
  88. # Enable drush autocomplete support
  89. autoload bashcompinit
  90. bashcompinit
  91. source $(dirname $0)/drush.complete.sh