1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 05:40:08 +00:00
ohmyzsh/plugins/drush/drush.plugin.zsh

108 lines
2.5 KiB
Bash
Raw Normal View History

# Functions
2019-03-29 21:39:52 +00:00
function dren() {
drush en "$@" -y
2019-03-29 21:39:52 +00:00
}
function dris() {
drush pm-disable "$@" -y
2019-03-29 21:39:52 +00:00
}
function drpu() {
drush pm-uninstall "$@" -y
2019-03-29 21:39:52 +00:00
}
function drf() {
if [[ -z "$1" ]] then
2019-03-29 21:39:52 +00:00
drush core-config
else
drush core-config --choice=$1
fi
}
function drfi() {
case "$1" in
fields) drush field-info fields ;;
types) drush field-info types ;;
*) drush field-info ;;
esac
2019-03-29 21:39:52 +00:00
}
function drnew() {
(
cd
echo "Website's name: "
read WEBSITE_NAME
2019-03-29 21:39:52 +00:00
HOST=http://$(hostname -i)/
2019-03-29 21:39:52 +00:00
if [[ $WEBSITE_NAME == "" ]] then
MINUTES=$(date +%M:%S)
WEBSITE_NAME="Drupal-$MINUTES"
echo "Your website will be named: $WEBSITE_NAME"
fi
2019-03-29 21:39:52 +00:00
drush dl drupal --drupal-project-rename=$WEBSITE_NAME
2019-03-29 21:39:52 +00:00
echo "Type your localhost directory: (Leave empty for /var/www/html/)"
read DIRECTORY
2019-03-29 21:39:52 +00:00
if [[ $DIRECTORY == "" ]] then
DIRECTORY="/var/www/html/"
fi
2019-03-29 21:39:52 +00:00
echo "Moving to $DIRECTORY$WEBSITE_NAME"
sudo mv $WEBSITE_NAME $DIRECTORY
cd $DIRECTORY$WEBSITE_NAME
2019-03-29 21:39:52 +00:00
echo "Database's user: "
read DATABASE_USR
echo "Database's password: "
read -s DATABASE_PWD
echo "Database's name for your project: "
read DATABASE
2019-03-29 21:39:52 +00:00
DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE"
drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME
2019-03-29 21:39:52 +00:00
open_command $HOST$WEBSITE_NAME
echo "Done"
)
2019-03-29 21:39:52 +00:00
}
# Aliases
2019-03-29 21:39:52 +00:00
alias dr="drush"
alias drca="drush cc all" # Deprecated for Drush 8
alias drcb="drush cc block" # Deprecated for Drush 8
alias drcex="drush config:export -y"
2019-03-29 21:39:52 +00:00
alias drcg="drush cc registry" # Deprecated for Drush 8
alias drcim="drush config:import -y"
2019-03-29 21:39:52 +00:00
alias drcj="drush cc css-js"
alias drcm="drush cc menu"
alias drcml="drush cc module-list"
alias drcr="drush core-cron"
alias drct="drush cc theme-registry"
alias drcv="drush cc views"
alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql"
alias drf="drush features"
alias drfr="drush features-revert -y"
alias drfra="drush features-revert-all"
alias drfu="drush features-update -y"
2019-03-29 21:39:52 +00:00
alias drif="drush image-flush --all"
alias drpm="drush pm-list --type=module"
alias drst="drush core-status"
alias druli="drush user:login"
2019-03-29 21:39:52 +00:00
alias drup="drush updatedb"
alias drups="drush updatedb-status"
alias drv="drush version"
alias drvd="drush variable-del"
alias drvg="drush variable-get"
alias drvs="drush variable-set"
alias drws="drush watchdog:show"
alias drwse="drush watchdog:show --extended"
alias drwst="drush watchdog:tail"
2019-03-29 21:39:52 +00:00
# Enable drush autocomplete support
autoload bashcompinit
bashcompinit
2019-03-29 21:39:52 +00:00
source $(dirname $0)/drush.complete.sh