2 #include <ccan/tap/tap.h>
8 #include <ccan/opt/opt.c>
9 #include <ccan/opt/usage.c>
11 static char *my_cb(void *p)
17 int main(int argc, char *argv[])
21 opt_register_table(subtables, NULL);
22 opt_register_noarg("--kkk", 'k', my_cb, NULL, "magic kkk option");
23 output = opt_usage("my name", "ExTrA Args");
25 ok1(strstr(output, "Usage: my name"));
26 ok1(strstr(output, "--jjj/-j <arg>"));
27 ok1(strstr(output, "ExTrA Args"));
28 ok1(strstr(output, "-a "));
29 ok1(strstr(output, " Description of a\n"));
30 ok1(strstr(output, "-b <arg>"));
31 ok1(strstr(output, " Description of b\n"));
32 ok1(strstr(output, "--ddd "));
33 ok1(strstr(output, " Description of ddd\n"));
34 ok1(strstr(output, "--eee <arg> "));
35 ok1(strstr(output, " Description of eee\n"));
36 ok1(strstr(output, "long table options:\n"));
37 /* This table is hidden. */
38 ok1(!strstr(output, "--ggg/-g "));
39 ok1(!strstr(output, " Description of ggg\n"));
40 ok1(!strstr(output, "--hhh/-h <arg>"));
41 ok1(!strstr(output, " Description of hhh\n"));
42 ok1(strstr(output, "--kkk/-k"));
43 ok1(strstr(output, "magic kkk option"));