github.com/mikespook/gleam@v0.0.0-20170807230223-29a9392b522c/cmd/gleam/main.go (about)

     1  package main
     2  
     3  import (
     4  	"flag"
     5  	"log"
     6  
     7  	"github.com/mikespook/gleam"
     8  )
     9  
    10  var (
    11  	scripts string
    12  	version string
    13  	showVer bool
    14  )
    15  
    16  func init() {
    17  	flag.StringVar(&scripts, "scripts", "./scripts/", "Lua scripts directory")
    18  	flag.BoolVar(&showVer, "version", false, "Show version")
    19  	flag.Parse()
    20  }
    21  
    22  func main() {
    23  	if showVer {
    24  		log.Printf("Version: %s", version)
    25  		return
    26  	}
    27  	g := gleam.NewGleam(scripts)
    28  	if err := g.Init(); err != nil {
    29  		log.Fatal(err)
    30  	}
    31  
    32  	g.Serve()
    33  
    34  	if err := g.Final(); err != nil {
    35  		log.Fatal(err)
    36  	}
    37  }