Skip to content

Commit

Permalink
feat: added version as a separate command
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan committed Dec 16, 2020
1 parent 07a915f commit b7c06d4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bin/vproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,16 @@ func parseFlags() {
},
},
},
{
Name: "version",
Usage: "print the version",
Action: printVersion,
},
},
}

cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("%s version %s (commit: %s, built %s)\n", c.App.Name, c.App.Version, commit, date)
printVersion(c)
}

err := app.Run(os.Args)
Expand All @@ -125,6 +130,11 @@ func verbose(c *cli.Context, a ...interface{}) {
}
}

func printVersion(c *cli.Context) error {
fmt.Printf("%s version %s (commit: %s, built %s)\n", c.App.Name, c.App.Version, commit, date)
return nil
}

func startClient(c *cli.Context) error {
host := c.String("host")
httpPort := c.Int("http")
Expand Down

0 comments on commit b7c06d4

Please sign in to comment.