summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorpepedinho <2spii94@gmail.com>2026-01-14 20:15:40 +0100
committerpepedinho <2spii94@gmail.com>2026-01-14 20:15:40 +0100
commit3ca9dc2dd4601ab1411f09a813aabb3a0b71fcfb (patch)
treeb10cafa941e4261cfda232ba92be3f7de6974f2e /src/main.c
parenta918df69269a39ef7350a645b5db025d66ecb18a (diff)
Added --version flag to zc cli
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 580b555..49691ea 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,6 +21,11 @@ void print_search_paths()
printf(" /usr/share/zenc\n");
}
+void print_version()
+{
+ printf("Zen C version %s\n", ZEN_VERSION);
+}
+
void print_usage()
{
printf("Usage: zc [command] [options] <file.zc>\n");
@@ -32,6 +37,7 @@ void print_usage()
printf(" transpile Transpile to C code only (no compilation)\n");
printf(" lsp Start Language Server\n");
printf("Options:\n");
+ printf(" --version Print version information");
printf(" -o <file> Output executable name\n");
printf(" --emit-c Keep generated C file (out.c)\n");
printf(" --freestanding Freestanding mode (no stdlib)\n");
@@ -119,6 +125,11 @@ int main(int argc, char **argv)
{
g_config.emit_c = 1;
}
+ else if (strcmp(arg, "--version") == 0|| strcmp(arg, "-V") == 0)
+ {
+ print_version();
+ return 0;
+ }
else if (strcmp(arg, "--verbose") == 0 || strcmp(arg, "-v") == 0)
{
g_config.verbose = 1;