diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-02-05 09:42:31 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-02-05 09:42:31 -0800 |
commit | 008028a910b1bb820ad14b976665acf0f5cd4015 (patch) | |
tree | 1c71dffb14a12743c5e9d01d98b9780e1894e455 /parse-options.c | |
parent | Merge branch 'jc/qsort-s-alignment-fix' (diff) | |
parent | cat-file: s/_/-/ in typo'd usage_msg_optf() message (diff) | |
download | tgif-008028a910b1bb820ad14b976665acf0f5cd4015.tar.xz |
Merge branch 'ab/cat-file'
Assorted updates to "git cat-file", especially "-h".
* ab/cat-file:
cat-file: s/_/-/ in typo'd usage_msg_optf() message
cat-file: don't whitespace-pad "(...)" in SYNOPSIS and usage output
cat-file: use GET_OID_ONLY_TO_DIE in --(textconv|filters)
object-name.c: don't have GET_OID_ONLY_TO_DIE imply *_QUIETLY
cat-file: correct and improve usage information
cat-file: fix remaining usage bugs
cat-file: make --batch-all-objects a CMDMODE
cat-file: move "usage" variable to cmd_cat_file()
cat-file docs: fix SYNOPSIS and "-h" output
parse-options API: add a usage_msg_optf()
cat-file tests: test messaging on bad objects/paths
cat-file tests: test bad usage
Diffstat (limited to 'parse-options.c')
-rw-r--r-- | parse-options.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c index a8283037be..2437ad3bcd 100644 --- a/parse-options.c +++ b/parse-options.c @@ -1079,3 +1079,16 @@ void NORETURN usage_msg_opt(const char *msg, die_message("%s\n", msg); /* The extra \n is intentional */ usage_with_options(usagestr, options); } + +void NORETURN usage_msg_optf(const char * const fmt, + const char * const *usagestr, + const struct option *options, ...) +{ + struct strbuf msg = STRBUF_INIT; + va_list ap; + va_start(ap, options); + strbuf_vaddf(&msg, fmt, ap); + va_end(ap); + + usage_msg_opt(msg.buf, usagestr, options); +} |