libk  testbin.exe.c at [9408112a57]

File mod/kcli/testbin.exe.c artifact 92e78f7400 part of check-in 9408112a57


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