From 2eb28736a05c7083f2b30b501954a789bbd85f88 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 2 Sep 2015 15:18:11 +0200 Subject: Add --short-usage option When combined with --long-usage, it makes CLI generate both short and long usage printing code. --- cli/context.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cli/context.cxx') diff --git a/cli/context.cxx b/cli/context.cxx index af6b58f..1324b0c 100644 --- a/cli/context.cxx +++ b/cli/context.cxx @@ -101,7 +101,6 @@ context (ostream& os_, options (ops), modifier (options.generate_modifier ()), specifier (options.generate_specifier ()), - usage (!options.suppress_usage ()), inl (data_->inl_), opt_prefix (options.option_prefix ()), opt_sep (options.option_separator ()), @@ -109,6 +108,16 @@ context (ostream& os_, reserved_name_map (options.reserved_name ()), keyword_set (data_->keyword_set_) { + if (options.suppress_usage ()) + usage = ut_none; + else + { + if (options.long_usage ()) + usage = options.short_usage () ? ut_both : ut_long; + else + usage = ut_short; + } + if (!options.suppress_inline ()) data_->inl_ = "inline "; -- cgit v1.1