diff options
author | Mathias Bynens <mathias@qiwi.be> | 2011-12-31 11:42:42 +0100 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2011-12-31 11:42:42 +0100 |
commit | 958517dcf4210aefffcafa3cc41f4ebb4edd5e36 (patch) | |
tree | 6386586884a74f4f90564414acb1adb01277bd5a /.functions | |
parent | 147eff27785380412afb352aa9dc050554887fa0 (diff) | |
download | dotfiles-958517dcf4210aefffcafa3cc41f4ebb4edd5e36.tar.gz dotfiles-958517dcf4210aefffcafa3cc41f4ebb4edd5e36.tar.bz2 dotfiles-958517dcf4210aefffcafa3cc41f4ebb4edd5e36.zip |
Replace the `server` alias with a function that optionally takes an argument specifying the port number
Inspired by @padolsey’s https://gist.github.com/1525217#gistcomment-71652.
Diffstat (limited to '.functions')
-rw-r--r-- | .functions | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -3,6 +3,13 @@ function md() { mkdir -p "$@" && cd "$@" } +# Start an HTTP server from a directory, optionally specifying the port +function server() { + local port="$1" + [ -z "$port" ] && port=8000 + open "http://localhost:${port}/" && python -m SimpleHTTPServer "$port" +} + # Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL. # Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!) function httpcompression() { |