libk  Diff

Differences From Artifact [9c55c30fa9]:

To Artifact [92e78f7400]:


1
2
3
4
5





















6
7
8


9
10
11
12
13
14
#include <k/core.h>
#include <k/cli.h>

stat
entry (kenv e) {





















	kcli_set testbin = {
		"testbin", "1.0.0", e.args, e.argc,
		"this is a test of the kcli module",


	};

	kcond c = kcli_usage(testbin, e.err);

	return c;
}





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>
>






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <k/core.h>
#include <k/cli.h>

stat
entry (kenv e) {
	kcli_flag verbose = false,
	          debug = false;
	
	kcli_opt options[] = {
		{ "v", "verbose", kcli_opt_flag, &verbose,
		  "induce information overload" },
		{ "d", "debug-mode", kcli_opt_flag, &debug,
		  "run the program in debug mode"},
	};

	const char* perp, * place, * weapon;

	kcli_param params[] = {
		{"perp", kcli_param_string, kcli_rule_required, &perp,
		 "the one who did the dastardly deed"},
		{"place", kcli_param_string, kcli_rule_required, &place,
		 "where the crime was committed"},
		{"murder weapon", kcli_param_string, kcli_rule_optional, &weapon,
		 "the implement used to murder the victim"},
	};

	kcli_set testbin = {
		"testbin", "1.0.0", e.args, e.argc,
		"this is a test of the kcli module",
		params, Kmsz(params),
		options, Kmsz(options),
	};

	kcond c = kcli_usage(testbin, e.err);

	return c;
}