From 11d3e0294d6c4d657c45c6f8de23dd628b61680d Mon Sep 17 00:00:00 2001 From: hachem Date: Sun, 30 Aug 2026 00:59:52 +0200 Subject: add: command-line argument parser --- src/main.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 902e18a..a14d2ba 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,22 @@ #include -int main(void) +#include "cli/args.h" + +int main(int argc, char** argv) { - puts("type shi"); + struct Args args; + + enum ParseResult result = parse_args(argc, argv, &args); + if (result == PARSE_EXIT) + return 0; + if (result == PARSE_ERROR) + return 1; + + static const char* target_names[] = { "nasm", "fasm", "masm" }; + + printf("input: %s\n", args.input_path); + printf("output: %s\n", args.output_path != NULL ? args.output_path : ""); + printf("target: %s\n", target_names[args.target]); + + return 0; } -- cgit v1.3