[util] Don't show --output-format if no supported formats provided

This commit is contained in:
Behdad Esfahbod 2021-08-07 12:22:17 -06:00
parent 5545eea7e5
commit 9db0fd4821
1 changed files with 4 additions and 5 deletions

View File

@ -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<char **> (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,