From 2d2be7e2b38031f7cd826f78543b18a287423ad7 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 22 Jan 2026 23:18:16 +0100 Subject: fix!: reach 96% line coverage, add tests, fix bugs --- examples/basic_example.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 examples/basic_example.c (limited to 'examples/basic_example.c') diff --git a/examples/basic_example.c b/examples/basic_example.c new file mode 100644 index 0000000..293d5c5 --- /dev/null +++ b/examples/basic_example.c @@ -0,0 +1,17 @@ +#define LS_ARGS_IMPLEMENTATION +#include "ls_args.h" + +int main(int argc, char** argv) { + ls_args args; + int help = 0; + const char* outfile = "out.txt"; + + ls_args_init(&args); + ls_args_bool(&args, &help, "h", "help", "Prints help", 0); + ls_args_string(&args, &outfile, "o", "out", "Specify the outfile, default 'out.txt'", 0); + if (!ls_args_parse(&args, argc, argv)) { + printf("Error: %s\n%s\n", args.last_error, ls_args_help(&args)); + } + ls_args_free(&args); + return 0; +} -- cgit