File mod/kcli/usage.fn.c artifact 09e6f94502 part of check-in 8d6b36fcac
#include <k/cli.h> #include <k/io.h> #include <k/str.h> kcond kcli_usage(kcli_set prg, kiochan ch) { ubyte buf_space [sizeof(ksbuf) + 256]; ksbuf* out = ksbufmk(buf_space, ch, 256); const char* msg [] = { prg.name, " v", prg.version, "\n\n", prg.desc, "\n\n", }; for (sz i = 0; i != Kmsz(msg); ++ i) { ksraw str = { 0, msg[i] }; kcond c = ksbufput(out, str); } return ksbufflush(out); }