Skip to content

Commit

Permalink
add version info
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosborn committed Nov 21, 2024
1 parent b5b6d0d commit db028fa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/base/version.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import strutils, times

const sep = '='.repeat(78)
const head = "QEX Compilation information:"
const comptime = " Time: " & staticExec("date")
const compmach = " Host: " & staticExec("uname -a")
const gitlog = " Log: " & staticExec("git log -1").indent(7).strip
const gitstat = " Status: " & staticExec("git status -uno").indent(10).strip
const buildInfo = [sep,head,comptime,compmach,gitlog,gitstat,sep].join("\n")
const gitrev = staticExec("git rev-parse HEAD")

static: echo buildInfo

proc getBuildInfo*(): string =
buildInfo

proc getVersion*(): string =
gitrev

when isMainModule:
echo getBuildInfo()
echo getVersion()

0 comments on commit db028fa

Please sign in to comment.