From e8e00267ae57c152739362ef623393d9816aa9d5 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 30 Jul 2025 14:30:53 -0400 Subject: Print full git tag with `tomo --verbose --version` --- src/tomo.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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" -- cgit v1.2.3