Add: version flag (-v)
This commit is contained in:
parent
bbb79f42c9
commit
10ed5858e8
15
main.go
15
main.go
@ -3,20 +3,33 @@ package main
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/oscarmlage/wikingo/server"
|
"github.com/oscarmlage/wikingo/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
app_name = "Wikingo"
|
||||||
|
app_version = "0.0.1"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("Starting wikingo...")
|
|
||||||
flag_debug := flag.Bool("d", false, "Enable debug mode")
|
flag_debug := flag.Bool("d", false, "Enable debug mode")
|
||||||
|
flag_version := flag.Bool("v", false, "Show version")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
// Version
|
||||||
|
if *flag_version {
|
||||||
|
fmt.Printf("%s - v%s\n", app_name, app_version)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
// Logger
|
// Logger
|
||||||
server.InitLogger(*flag_debug)
|
server.InitLogger(*flag_debug)
|
||||||
server.Debug.Printf("Yo there")
|
server.Debug.Printf("Yo there")
|
||||||
|
|
||||||
fmt.Println("Starting wikingo...")
|
fmt.Println("Starting wikingo...")
|
||||||
fmt.Printf("Debug mode: %t\n", *flag_debug)
|
fmt.Printf("Debug mode: %t\n", *flag_debug)
|
||||||
|
fmt.Printf("Version: %t\n", *flag_version)
|
||||||
server.Serve()
|
server.Serve()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user