Skip to content

Commit

Permalink
Merge pull request #69 from Cottser/edit-virtualhost
Browse files Browse the repository at this point in the history
Add edit functionality
  • Loading branch information
star-szr committed Nov 28, 2014
2 parents c3f9806 + 7ede241 commit bdd50c5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions virtualhost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,15 @@ __EOT
__EOF
}

edit_virtualhost()
{
if [ -e $APACHE_CONFIG/virtualhosts/$VIRTUALHOST ]; then
$EDITOR $APACHE_CONFIG/virtualhosts/$VIRTUALHOST
else
/bin/echo "VirtualHost $VIRTUALHOST not found."
fi
}

cleanup()
{
/bin/echo
Expand Down Expand Up @@ -525,6 +534,7 @@ usage()
cat << __EOT
Usage: sudo virtualhost.sh <name> [<optional path>]
sudo virtualhost.sh --list
sudo virtualhost.sh --edit <name>
sudo virtualhost.sh --delete <name>
where <name> is the one-word name you'd like to use. (e.g. mysite)
Expand Down Expand Up @@ -559,6 +569,15 @@ else
fi

exit
elif [ "$1" = "--edit" ]; then
if [ -z $2 ]; then
usage
else
VIRTUALHOST=`echo $2|sed -e 's/\///g'`
edit_virtualhost

exit
fi
else
VIRTUALHOST=`echo $1|sed -e 's/\///g'`
FOLDER=`echo $2 | sed -e 's/\/*$//'`
Expand Down

0 comments on commit bdd50c5

Please sign in to comment.