Skip to content

Commit

Permalink
Adding test flag and fixing readme. Version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyflyer committed Jan 2, 2018
1 parent daac12c commit f02163d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Just because I felt like it and coding is fun. I've been using `python -m Simple

# Installation

* `brew install qhttp`
* Install using Homebrew: `brew install qhttp`
* Download [binary](https://github.com/skyflyer/qhttp/releases/download/v0.1.0/qhttp.v0.1.0.zip) and extract. Copy to `/usr/local/bin`.

## From source

1. Clone this repo and
1. `go install`
1. `go get github.com/skyflyer/qhttp`
1. Execute `qhttp` from a directory you wish to serve.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ import (
"os"
)

const ver = "0.1.0"
const ver = "0.1.1"

func main() {
dir, _ := os.Getwd()
port := flag.String("port", "8000", "specify port number to listen to")
test := flag.Bool("test", false, "Print workding directory and exit")
flag.Parse()
log.Printf("Trying to bind to port %s\n", *port)
log.Printf("qhttp %s serving %s\n", ver, dir)

if *test == true {
os.Exit(0)
}
handler := logRequest(noCache(http.FileServer(http.Dir(dir))))
panic(http.ListenAndServe(fmt.Sprintf(":%s", *port), handler))
}

0 comments on commit f02163d

Please sign in to comment.