mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-11 03:28:09 +03:00
28d36c6f64
This reverts commit4373c78d82
, reversing changes made to6b78075f02
.
27 lines
469 B
Bash
Executable File
27 lines
469 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
TARGET="${1:-}"
|
|
if test -z "$TARGET"; then
|
|
echo "USAGE: ${0:-} directory-to-serve"
|
|
exit 1
|
|
fi
|
|
|
|
if ! test -d "$TARGET"; then
|
|
echo 'cannot serve a non-directory, exiting!'
|
|
exit 1
|
|
fi
|
|
|
|
if ! which python > /dev/null; then
|
|
echo 'need a python installed, exiting!'
|
|
exit 1
|
|
fi
|
|
|
|
cd "$TARGET"
|
|
|
|
if python --version | grep -qE '^Python 3'; then
|
|
exec python -m http.server
|
|
else
|
|
exec python -m SimpleHTTPServer
|
|
fi
|