package main

import (
	"flag"
	"log"
	"net/http"
	"strconv"
)

var (
	port int
	dir  string
)

func initFlags() {
	flag.IntVar(&port, "port", 8800, "listen port")
	flag.StringVar(&dir, "dir", "./", "dir")
}

func main() {
	initFlags()
	flag.Parse()
	ports := strconv.Itoa(port)
	log.Println("Listen HTTP on:" + ports)
	if err := http.ListenAndServe(":"+ports, http.FileServer(http.Dir(dir))); err != nil {
		panic(err)
	}
}
