From 9db0fd4821ab721bbf558e999044384726ba650e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 7 Aug 2021 12:22:17 -0600 Subject: [PATCH] [util] Don't show --output-format if no supported formats provided --- util/options.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/util/options.cc b/util/options.cc index 00573cb51..5cbd4a1b6 100644 --- a/util/options.cc +++ b/util/options.cc @@ -125,11 +125,9 @@ void output_options_t::add_options (option_parser_t *parser, const char **supported_formats) { - const char *text; + const char *text = nullptr; - if (!supported_formats) - text = "Set output format"; - else + if (supported_formats) { char *items = g_strjoinv ("/", const_cast (supported_formats)); text = g_strdup_printf ("Set output format\n\n Supported output formats are: %s", items); @@ -140,7 +138,8 @@ output_options_t::add_options (option_parser_t *parser, GOptionEntry entries[] = { {"output-file", 'o', 0, G_OPTION_ARG_STRING, &this->output_file, "Set output file-name (default: stdout)","filename"}, - {"output-format", 'O', 0, G_OPTION_ARG_STRING, &this->output_format, text, "format"}, + {"output-format", 'O', supported_formats ? 0 : G_OPTION_FLAG_HIDDEN, + G_OPTION_ARG_STRING, &this->output_format, text, "format"}, {nullptr} }; parser->add_group (entries,