2
0
Fork 0
mirror of https://github.com/Vonng/ddia.git synced 2026-06-20 16:45:44 +08:00
ddia/bin/serve
2021-08-12 15:42:58 +08:00

19 lines
No EOL
622 B
Bash
Executable file

#!/bin/bash
PROG_DIR="$(cd $(dirname $0) && pwd)"
DOCS_DIR="$(cd $(dirname ${PROG_DIR}) && pwd)"
# node.js (docsify) > python3 (http.server) > python2 (SimpleHTTPServer)
if command -v docsify; then
echo "serve with docsify (click url to view in browser)"
cd ${DOCS_DIR} && docsify serve
elif command -v python3; then
echo "serve http://localhost:3001 (python3 http.server)"
cd ${DOCS_DIR} && python3 -m http.server 3001
elif command -v python2; then
echo "serve http://localhost:3001 (python2 SimpleHTTPServer)"
cd ${DOCS_DIR} && python2 -m SimpleHTTPServer 3001
else
echo "no available server"
fi