-static struct argp_option main_options[] =
- {
- { NULL, 0, NULL, 0, "Main options", 0},
- { "test", 't', NULL, 0, NULL, 1 },
- { NULL, 0, NULL, 0, NULL, 0 }
- };
+static struct argp_option group2_1_option[] = {
+ { NULL, 0, NULL, 0, "Option Group 2.1", 0 },
+ { "poem", 'p', NULL, 0, "create a poem" },
+ { "limerick", 'l', NULL, 0, "create a limerick" },
+ { NULL, 0, NULL, 0, NULL, 0 }
+};
+
+static error_t
+group2_1_parser (int key, char *arg, struct argp_state *state)
+{
+ struct test_args *args = state->input;
+ switch (key)
+ {
+ case 'p':
+ case 'e':
+ args->group_2_1_option = key;
+ break;
+ default:
+ return ARGP_ERR_UNKNOWN;
+ }
+ return 0;
+}
+
+struct argp group2_1_argp = {
+ group2_1_option,
+ group2_1_parser
+};
+
+struct argp_child group2_1_child = {
+ &group2_1_argp,
+ 0,
+ "",
+ 2
+};
+\f
+
+static struct argp_option main_options[] = {
+ { NULL, 0, NULL, 0, "Main options", 0 },
+ { "test", 't', NULL, 0, NULL, 1 },
+ { NULL, 0, NULL, 0, NULL, 0 }
+};