libk  Artifact [92e78f7400]

Artifact 92e78f74004e6792eedaf24d7d0af6e687ed4d193a1c8b3d5a4e93fb7382a3df:


#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;
}