summaryrefslogtreecommitdiff
path: root/internal/flags
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-04-14 23:13:45 +0300
committerPaul Buetow <paul@buetow.org>2025-04-14 23:13:45 +0300
commit12759c56082abcc6b0eb70b5a5981e9ca61faa08 (patch)
tree241f588fdd0e38f2d7c1faf79920ffe01b472122 /internal/flags
parentf4c34929bedfb2c5b8fa32f16344200c72415cb9 (diff)
add -version flag and ASCII banner
Diffstat (limited to 'internal/flags')
-rw-r--r--internal/flags/flags.go7
-rw-r--r--internal/flags/version.go13
2 files changed, 20 insertions, 0 deletions
diff --git a/internal/flags/flags.go b/internal/flags/flags.go
index fc41062..fda921d 100644
--- a/internal/flags/flags.go
+++ b/internal/flags/flags.go
@@ -68,6 +68,8 @@ func Parse() {
}
func parse() {
+ version := flag.Bool("version", false, "Print version")
+
flag.IntVar(&singleton.PidFilter, "pid", -1, "Filter for processes ID")
flag.IntVar(&singleton.TidFilter, "tid", -1, "Filter for thread ID")
flag.IntVar(&singleton.EventMapSize, "mapSize", 4096*16, "BPF FD event ring buffer map size")
@@ -95,6 +97,11 @@ func parse() {
os.Getenv("HOME")+"/git/FlameGraph/flamegraph.pl", "Path to the flamegraph tool (e.g. flamegraph.pl or inferno-flamegraph)")
flag.Parse()
+ if *version {
+ PrintVersion()
+ os.Exit(0)
+ }
+
singleton.TracepointsToAttach = extractTracepointFlags(*tracepointsToAttach)
singleton.TracepointsToExclude = extractTracepointFlags(*tracepointsToExclude)
diff --git a/internal/flags/version.go b/internal/flags/version.go
new file mode 100644
index 0000000..1cb2dfd
--- /dev/null
+++ b/internal/flags/version.go
@@ -0,0 +1,13 @@
+package flags
+
+const version = `v0.0.0`
+
+const asciiBanner = ` ___   _____    ___ _     _   
+|_ _| / / _ \  | _ (_)___| |_ 
+ | | / / (_) | |   / / _ \  _|
+|___/_/ \___/  |_|_\_\___/\__| NG
+ ` + version
+
+func PrintVersion() {
+ println(asciiBanner)
+}