http-dir-server/main.go
2020-07-29 16:21:55 +02:00

29 lines
333 B
Go

package main
import (
"flag"
"fmt"
"os"
)
func main() {
var fdir string
flag.StringVar(&fdir, "d", "", "path to dir to serve")
flag.Parse()
if fdir == "" {
printHelp()
os.Exit(0)
}
s := Server{
port: ":8080",
dirPath: fdir,
}
s.Serve()
}
func printHelp() {
fmt.Println("Usage: -d path to dir to serve")
}