1
0
mirror of https://github.com/meineerde/dotfiles.git synced 2026-02-05 16:43:22 +00:00

Detect python3 when starting a simple http server

This commit is contained in:
Holger Just 2022-04-14 17:29:16 +02:00
parent d6f7f5b5ae
commit be1e716cd8

View File

@ -279,8 +279,12 @@ alias rc="bundle exec rails console"
ss() { if [[ -x script/server ]]; then bundle exec script/server webrick -b 127.0.0.1 "$@"; else rs $@; fi }
sc() { if [[ -x script/console ]]; then bundle exec script/console "$@"; else rc "$@"; fi }
http() {
port=${1:-8000}
python -m SimpleHTTPServer $port
port="${1:-8000}"
if type python3 >/dev/null 2>&1; then
python3 -m http.server "$port"
else
python -m SimpleHTTPServer "$port"
fi
}
# if cat is called on a directory, call ls instead