Subcommand serve should parse flags.

Signed-off-by: Justin Ko <justin.ko@oracle.com>
This commit is contained in:
Justin Ko 2018-03-07 14:56:35 -08:00
parent 0a409c6ccb
commit df660d35c7

View File

@ -28,6 +28,7 @@ func serve(args []string) {
}
portFlag := flags.String("port", ":8080", "Local port to serve on")
dirFlag := flags.String("directory", ".", "Directory to serve")
flags.Parse(args)
http.Handle("/", http.FileServer(http.Dir(*dirFlag)))
log.Fatal(http.ListenAndServe(*portFlag, logRequest(http.DefaultServeMux)))