Make prompt show url when in site folder

The url will be the folder name above public_html and .local appended to
it.
master
Jonathan Hodgson 7 years ago
parent 9c22592fb7
commit 907503e6a5
  1. 5
      config/oh-my-zsh/promptconfig.zsh

@ -25,12 +25,11 @@ function my_dir(){
#This is used for checking if wp or magento
local ph=${PWD%/public_html*}/public_html
# If in a site folder and a wp site, replace home/Sites/<site-name>/public_html with siteIcon <site-name>
# If in a site folder and a wp site, replace home/Sites/<site-name>/public_html with siteIcon <site-url>
if [[ -d $ph ]]; then
local icon=$siteIcon
if [[ -e "$ph/wp-config.php" ]]; then #If WordPress
icon=$wpSiteIcon
current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Sites\/([a-z_\-]*)\/public_html/$wpSiteIcon\1/")
# Change wp-content in sub folders
current_path=$(echo $current_path | sed -r -e "s/wp\-content\//wpc\//")
@ -38,7 +37,7 @@ function my_dir(){
elif [[ -d "$ph/pub/opt/magento" ]]; then #If magento
icon=$magentoSiteIcon
fi
current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Sites\/([a-z_\-]*)\/public_html/$icon\1/")
current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Sites\/([a-z_\-]*)\/public_html/$icon\1.local/")
fi

Loading…
Cancel
Save