forked from mcuadros/ofelia
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ofelia.go
27 lines (21 loc) · 592 Bytes
/
ofelia.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main
import (
"fmt"
"os"
"github.com/jessevdk/go-flags"
"github.com/mcuadros/ofelia/cli"
)
var version string
var build string
func main() {
parser := flags.NewNamedParser("ofelia", flags.Default)
parser.AddCommand("daemon", "daemon process", "", &cli.DaemonCommand{})
parser.AddCommand("validate", "validates the config file", "", &cli.ValidateCommand{})
if _, err := parser.Parse(); err != nil {
if _, ok := err.(*flags.Error); ok {
parser.WriteHelp(os.Stdout)
fmt.Printf("\nBuild information\n commit: %s\n date:%s\n", version, build)
}
os.Exit(1)
}
}