mirror of
https://github.com/meineerde/dotfiles.git
synced 2026-02-18 01:22:00 +00:00
Detect python3 when starting a simple http server
This commit is contained in:
parent
d6f7f5b5ae
commit
be1e716cd8
8
.bashrc
8
.bashrc
@ -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 }
|
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 }
|
sc() { if [[ -x script/console ]]; then bundle exec script/console "$@"; else rc "$@"; fi }
|
||||||
http() {
|
http() {
|
||||||
port=${1:-8000}
|
port="${1:-8000}"
|
||||||
python -m SimpleHTTPServer $port
|
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
|
# if cat is called on a directory, call ls instead
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user