Add -version flag

This commit is contained in:
Matthew Holt 2015-05-07 13:09:40 -06:00
parent a5f20829cb
commit 2ce5102473

15
main.go
View File

@ -20,10 +20,11 @@ import (
)
var (
conf string
http2 bool // TODO: temporary flag until http2 is standard
quiet bool
cpu string
conf string
http2 bool // TODO: temporary flag until http2 is standard
quiet bool
cpu string
version bool
)
func init() {
@ -34,6 +35,7 @@ func init() {
flag.StringVar(&config.Root, "root", config.DefaultRoot, "Root path to default site")
flag.StringVar(&config.Host, "host", config.DefaultHost, "Default host")
flag.StringVar(&config.Port, "port", config.DefaultPort, "Default port")
flag.BoolVar(&version, "version", false, "Show version")
config.AppName = "Caddy"
config.AppVersion = "0.6.0"
@ -42,6 +44,11 @@ func init() {
func main() {
flag.Parse()
if version {
fmt.Printf("%s %s\n", config.AppName, config.AppVersion)
os.Exit(0)
}
var wg sync.WaitGroup
// Set CPU cap