aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-07-30 14:30:53 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-07-30 14:30:53 -0400
commite8e00267ae57c152739362ef623393d9816aa9d5 (patch)
tree92f2353928653868797e53d0277511769f180119 /src
parentd39d2810121a52625d3950c8a4f53422243b46c2 (diff)
Print full git tag with `tomo --verbose --version`
Diffstat (limited to 'src')
-rw-r--r--src/tomo.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tomo.c b/src/tomo.c
index cf3508bd..3cfa718d 100644
--- a/src/tomo.c
+++ b/src/tomo.c
@@ -64,6 +64,7 @@ static OptionalList_t files = NONE_LIST,
libraries = NONE_LIST;
static OptionalBool_t verbose = false,
quiet = false,
+ show_version = false,
show_parse_tree = false,
show_prefix = false,
stop_at_transpile = false,
@@ -195,6 +196,7 @@ int main(int argc, char *argv[])
{"args", true, List$info(&Text$info), &args},
{"verbose", false, &Bool$info, &verbose},
{"v", false, &Bool$info, &verbose},
+ {"version", false, &Bool$info, &show_version},
{"parse", false, &Bool$info, &show_parse_tree},
{"p", false, &Bool$info, &show_parse_tree},
{"prefix", false, &Bool$info, &show_prefix},
@@ -233,6 +235,14 @@ int main(int argc, char *argv[])
return 0;
}
+ if (show_version) {
+ if (verbose)
+ print(TOMO_VERSION, " ", GIT_VERSION);
+ else
+ print(TOMO_VERSION);
+ return 0;
+ }
+
bool is_gcc = (system(String(cc, " -v 2>&1 | grep -q 'gcc version'")) == 0);
if (is_gcc) {
cflags = Texts(cflags, Text(" -fsanitize=signed-integer-overflow -fno-sanitize-recover"