Skip to content

Commit

Permalink
added -v/-version cmd-line flag
Browse files Browse the repository at this point in the history
  • Loading branch information
steveyen committed Apr 7, 2015
1 parent 0716475 commit a5993d2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/cbft/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type Flags struct {
Server string
Tags string
Container string
Version bool
Weight int
Register string
CfgConnect string
Expand Down Expand Up @@ -122,6 +123,9 @@ func initFlags(flags *Flags) map[string][]string {
[]string{"container"}, "",
"slash separated path of parent containers for this node,"+
"\nfor shelf/rack/row/zone awareness")
b(&flags.Version,
[]string{"version", "v"}, false,
"print version string and exit")
i(&flags.Weight,
[]string{"weight"}, 1,
"weight of this node (a more capable node has higher weight)")
Expand Down Expand Up @@ -184,6 +188,12 @@ func main() {
os.Exit(2)
}

if flags.Version {
fmt.Printf("%s main: %s, data: %s\n", path.Base(os.Args[0]),
VERSION, cbft.VERSION)
os.Exit(0)
}

log.Printf("main: %s started (%s/%s)",
os.Args[0], VERSION, cbft.VERSION)

Expand Down

0 comments on commit a5993d2

Please sign in to comment.