aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLion Kortlepel <[email protected]>2026-02-01 13:00:37 +0000
committerLion Kortlepel <[email protected]>2026-02-01 13:00:37 +0000
commitb13f5c7b5a21ac3ad03fd980f085a86531d37f27 (patch)
treeaafeedd5f5ce3feff2368918496c9ecfb1dcbc1b
parent3c7b67aceb1ccf75e71358e84d9cc58d01b9abd5 (diff)
downloadargs-b13f5c7b5a21ac3ad03fd980f085a86531d37f27.tar.zst
args-b13f5c7b5a21ac3ad03fd980f085a86531d37f27.zip
docs: improve example in docs
-rw-r--r--ls_args.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/ls_args.h b/ls_args.h
index de87a9b..f27b491 100644
--- a/ls_args.h
+++ b/ls_args.h
@@ -41,18 +41,29 @@
* // ...
* ls_args args;
* int help = 0;
- * const char* infile;
* const char* outfile = "out.txt";
+ * const char* infile;
+ * const char* testfile;
*
* ls_args_init(&args);
+ * args.help_description = "Some description"; // optional
* ls_args_bool(&args, &help, "h", "help", "Prints help", 0);
* ls_args_string(&args, &outfile, "o", "out",
- * "Specify the outfile, default 'out.txt'", 0);
- * ls_args_pos_string(&args, &infile, "input file")
+ * "Specify the outfile, default 'out.txt'", 0);
+ * ls_args_pos_string(&args, &infile, "input file", LS_ARGS_REQUIRED);
+ * ls_args_pos_string(&args, &testfile, "test file", 0);
* if (!ls_args_parse(&args, argc, argv)) {
- * printf("Error: %s\n%s\n", args.last_error,
- * ls_args_help(&args));
+ * if (help) {
+ * puts(ls_args_help(&args));
+ * } else {
+ * printf("Error: %s\n", args.last_error);
+ * }
+ * ls_args_free(&args);
+ * return 1;
* }
+ *
+ * // TODO: Do something here with your arguments!
+ *
* ls_args_free(&args);
*
* ==== 3. LICENSE ====