Skip to content

Commit 55a4eb1

Browse files
Armin BecherArmin Becher
Armin Becher
authored and
Armin Becher
committed
feat: add version cli paramter
1 parent 78444ee commit 55a4eb1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

main.go

+7
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,23 @@ func main() {
1717
var host string
1818
var dbgFile string
1919
var port int
20+
var versionFlag bool
2021
flag.StringVar(&host, "host", "localhost", "The pprof server IP or hostname")
2122
flag.IntVar(&port, "port", 6060, "The pprof server port")
2223
flag.StringVar(&dbgFile, "debug", "", "Path to debug file")
24+
flag.BoolVar(&versionFlag, "v", false, "Print version of roumon and exit")
2325
flag.Parse()
2426

2527
version := "dev"
2628
if info, ok := debug.ReadBuildInfo(); ok {
2729
version = info.Main.Version
2830
}
2931

32+
if versionFlag {
33+
fmt.Println(version)
34+
return
35+
}
36+
3037
if len(dbgFile) > 0 {
3138
f, err := os.OpenFile(dbgFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
3239
if err != nil {

0 commit comments

Comments
 (0)