diff --git a/serve b/serve index 7bd348c..8b35a1a 100755 --- a/serve +++ b/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