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[])
22 opt_register_table(subtables, NULL);
23 opt_register_noarg("--kkk/-k", my_cb, NULL, "magic kkk option");
24 output = opt_usage("my name", "ExTrA Args");
26 ok1(strstr(output, "Usage: my name"));
27 ok1(strstr(output, "--jjj/-j/--lll/-l <arg>"));
28 ok1(strstr(output, "ExTrA Args"));
29 ok1(strstr(output, "-a "));
30 ok1(strstr(output, " Description of a\n"));
31 ok1(strstr(output, "-b <arg>"));
32 ok1(strstr(output, " Description of b (default: b)\n"));
33 ok1(strstr(output, "--ddd "));
34 ok1(strstr(output, " Description of ddd\n"));
35 ok1(strstr(output, "--eee <arg> "));
36 ok1(strstr(output, " (default: eee)\n"));
37 ok1(strstr(output, "long table options:\n"));
38 ok1(strstr(output, "--ggg/-g "));
39 ok1(strstr(output, " Description of ggg\n"));
40 ok1(strstr(output, "-h/--hhh <arg>"));
41 ok1(strstr(output, " Description of hhh\n"));
42 ok1(strstr(output, "--kkk/-k"));
43 ok1(strstr(output, "magic kkk option"));
44 /* This entry is hidden. */
45 ok1(!strstr(output, "--mmm/-m"));