We encourage to spell an argument hint that consists of multiple
words as a single-token separated with dashes.  In order to help
catching violations added by new callers of parse-options, make sure
argh does not contain SP or _ when the code validates the option
definitions.

Signed-off-by: Junio C Hamano <gits...@pobox.com>
---
 parse-options.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/parse-options.c b/parse-options.c
index a5fa0b8..c81d3a0 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -375,6 +375,9 @@ static void parse_options_check(const struct option *opts)
                default:
                        ; /* ok. (usually accepts an argument) */
                }
+               if (opts->argh &&
+                   strcspn(opts->argh, " _") != strlen(opts->argh))
+                       err |= optbug(opts, "multi-word argh should use dash to 
separate words");
        }
        if (err)
                exit(128);
-- 
1.9.1-471-gcccbd8b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to