isl_arg_parse: support ISL_ARG_HIDDEN flag
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 21 Nov 2010 11:00:40 +0000 (12:00 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 26 Nov 2010 14:59:44 +0000 (15:59 +0100)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
include/isl/arg.h
isl_arg.c

index 2269bd3..ad09598 100644 (file)
@@ -52,6 +52,7 @@ struct isl_arg {
        const char              *help_msg;
 #define ISL_ARG_SINGLE_DASH    (1 << 0)
 #define ISL_ARG_BOOL_ARG       (1 << 1)
+#define ISL_ARG_HIDDEN         (1 << 2)
        unsigned                 flags;
        union {
        struct {
index 533efac..b19778a 100644 (file)
--- a/isl_arg.c
+++ b/isl_arg.c
@@ -427,6 +427,8 @@ static void print_help(struct isl_arg *arg, const char *prefix)
        int i;
 
        for (i = 0; arg[i].type != isl_arg_end; ++i) {
+               if (arg[i].flags & ISL_ARG_HIDDEN)
+                       continue;
                switch (arg[i].type) {
                case isl_arg_flags:
                        print_flags_help(&arg[i], prefix);
@@ -459,6 +461,8 @@ static void print_help(struct isl_arg *arg, const char *prefix)
        for (i = 0; arg[i].type != isl_arg_end; ++i) {
                if (arg[i].type != isl_arg_child)
                        continue;
+               if (arg[i].flags & ISL_ARG_HIDDEN)
+                       continue;
 
                printf("\n");
                if (arg[i].help_msg)