diff --git a/nginx-modsite b/nginx-modsite index 8086057..032875c 100644 --- a/nginx-modsite +++ b/nginx-modsite @@ -76,6 +76,16 @@ ngx_disable_site() { ngx_reload } +ngx_edit_site() { + [[ ! "$SELECTED_SITE" ]] && + ngx_select_site "not_enabled" + + [[ ! -e "$NGINX_SITES_AVAILABLE/$SELECTED_SITE" ]] && + ngx_error "Site does not appear to exist." + + nano "$NGINX_SITES_AVAILABLE/$SELECTED_SITE" +} + ngx_list_site() { echo "Available sites:" ngx_sites "available" @@ -146,6 +156,7 @@ ngx_help() { echo "Options:" echo -e "\t<-e|--enable> \tEnable site" echo -e "\t<-d|--disable> \tDisable site" + echo -e "\t<-x|--edit>\t\tEdit site" echo -e "\t<-l|--list>\t\tList sites" echo -e "\t<-h|--help>\t\tDisplay help" echo -e "\n\tIf is left out a selection of options will be presented." @@ -160,6 +171,7 @@ ngx_help() { case "$1" in -e|--enable) ngx_enable_site;; -d|--disable) ngx_disable_site;; + -x|--edit) ngx_edit_site;; -r|--reload) ngx_reload_now;; -l|--list) ngx_list_site;; -h|--help) ngx_help;;