quaker pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d660dd12bbfb984a70375a0482b9252b82fb9695
commit d660dd12bbfb984a70375a0482b9252b82fb9695 Author: Daniel Kolesa <quake...@gmail.com> Date: Wed Jan 15 20:22:27 2014 +0000 ecore_getopt: support for categories --- src/lib/ecore/Ecore_Getopt.h | 6 +++++- src/lib/ecore/ecore_getopt.c | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore/Ecore_Getopt.h b/src/lib/ecore/Ecore_Getopt.h index 64e3eed..d41ed3e 100644 --- a/src/lib/ecore/Ecore_Getopt.h +++ b/src/lib/ecore/Ecore_Getopt.h @@ -65,7 +65,8 @@ typedef enum { ECORE_GETOPT_ACTION_VERSION, ECORE_GETOPT_ACTION_COPYRIGHT, ECORE_GETOPT_ACTION_LICENSE, - ECORE_GETOPT_ACTION_BREAK + ECORE_GETOPT_ACTION_BREAK, + ECORE_GETOPT_ACTION_CATEGORY } Ecore_Getopt_Action; typedef enum { @@ -389,6 +390,9 @@ struct _Ecore_Getopt ECORE_GETOPT_ACTION_BREAK, \ {.dummy = NULL}} +#define ECORE_GETOPT_CATEGORY(name) \ + {0, NULL, name, NULL, ECORE_GETOPT_ACTION_CATEGORY, {.dummy = NULL}} + #define ECORE_GETOPT_SENTINEL {0, NULL, NULL, NULL, 0, {.dummy = NULL}} #define ECORE_GETOPT_VALUE_STR(val) {.strp = &(val)} diff --git a/src/lib/ecore/ecore_getopt.c b/src/lib/ecore/ecore_getopt.c index 2af5d47..b2195be 100644 --- a/src/lib/ecore/ecore_getopt.c +++ b/src/lib/ecore/ecore_getopt.c @@ -629,6 +629,12 @@ _ecore_getopt_help_desc(FILE *fp, int metavarlen = 3; int used; + if (desc->action == ECORE_GETOPT_ACTION_CATEGORY) + { + fprintf(fp, "\n%s\n", desc->help); + return; + } + arg_req = _ecore_getopt_desc_arg_requirement(desc); if (arg_req != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO) _ecore_getopt_help_desc_setup_metavar --