Skip to content

Commit

Permalink
feat: add version cli paramter
Browse files Browse the repository at this point in the history
  • Loading branch information
Armin Becher authored and Armin Becher committed Jan 4, 2024
1 parent 78444ee commit 55a4eb1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,23 @@ func main() {
var host string
var dbgFile string
var port int
var versionFlag bool
flag.StringVar(&host, "host", "localhost", "The pprof server IP or hostname")
flag.IntVar(&port, "port", 6060, "The pprof server port")
flag.StringVar(&dbgFile, "debug", "", "Path to debug file")
flag.BoolVar(&versionFlag, "v", false, "Print version of roumon and exit")
flag.Parse()

version := "dev"
if info, ok := debug.ReadBuildInfo(); ok {
version = info.Main.Version
}

if versionFlag {
fmt.Println(version)
return
}

if len(dbgFile) > 0 {
f, err := os.OpenFile(dbgFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
Expand Down

0 comments on commit 55a4eb1

Please sign in to comment.