From 41cdb8ba267c286ec93d5fa8d0c7f2201492592c Mon Sep 17 00:00:00 2001 From: Daniel Kaiser Date: Tue, 17 May 2022 22:11:07 +0200 Subject: [PATCH] feat(info): add --version cmd flag (#970) --- waku/v2/node/config.nim | 5 +++++ waku/v2/node/wakunode2.nim | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/waku/v2/node/config.nim b/waku/v2/node/config.nim index ca40fe614..10f629d33 100644 --- a/waku/v2/node/config.nim +++ b/waku/v2/node/config.nim @@ -27,6 +27,11 @@ type desc: "Sets the log level." defaultValue: LogLevel.INFO name: "log-level" }: LogLevel + + version* {. + desc: "prints the version" + defaultValue: false + name: "version" }: bool nodekey* {. desc: "P2P node private key as 64 char hex string.", diff --git a/waku/v2/node/wakunode2.nim b/waku/v2/node/wakunode2.nim index 95ab79728..2c709a037 100644 --- a/waku/v2/node/wakunode2.nim +++ b/waku/v2/node/wakunode2.nim @@ -1306,6 +1306,12 @@ when isMainModule: quit 1 # if we don't leave here, the initialization of conf does not work in the success case {.pop.} + # if called with --version, print the version and quit + if conf.version: + const git_version {.strdefine.} = "n/a" + echo "version / git commit hash: ", git_version + quit(QuitSuccess) + var node: WakuNode # This is the node we're going to setup using the conf