fix SRV_ARGS should be declared as an array
This commit is contained in:
parent
1de8d1d791
commit
f4f8e15bf1
1 changed files with 7 additions and 7 deletions
14
serve
14
serve
|
|
@ -9,7 +9,7 @@ PORT="8000" # bind port
|
|||
WEBROOT="www" # root web directory
|
||||
USE_INDEX=true
|
||||
NO_CACHE=true
|
||||
SRV_ARGS=""
|
||||
declare -a SRV_ARGS=()
|
||||
|
||||
SCSS_PATH="$WEBROOT/scss"
|
||||
CSS_PATH="$WEBROOT/css"
|
||||
|
|
@ -21,21 +21,21 @@ function watch_scss {
|
|||
sass --watch "$SCSS_PATH:$CSS_PATH"
|
||||
}
|
||||
|
||||
function host (
|
||||
local args="$SRV_ARGS"
|
||||
function host {
|
||||
local args=$@
|
||||
# Apply Flags
|
||||
if [[ "$NO_CACHE" == true ]]; then
|
||||
args+=" --nocache"
|
||||
args+=("--nocache")
|
||||
fi
|
||||
if [[ "$USE_INDEX" == true ]]; then
|
||||
args+=" --index"
|
||||
args+=("--index")
|
||||
fi
|
||||
|
||||
# Apply Options
|
||||
args+=" --ip \"$ADDR\" --port \"$PORT\""
|
||||
args+=(--ip "$ADDR" --port "$PORT")
|
||||
|
||||
simple-http-server $args $@ -- "$WEBROOT"
|
||||
)
|
||||
}
|
||||
|
||||
set -ueo pipefail
|
||||
set -x
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue