diff --git a/util/meson.build b/util/meson.build index 6448b9881..1a5472bb5 100644 --- a/util/meson.build +++ b/util/meson.build @@ -23,6 +23,8 @@ else help2man = disabler() endif help2man_command = [help2man, '--help-option=--help-all', '--no-info', '--output=' + '@OUTPUT@', '@INPUT@'] +help2man_env = environment() +help2man_env.set('HB_UTIL_HELP_VERBOSE', '1') util_deps = [freetype_dep, cairo_dep, cairo_ft_dep, glib_dep] @@ -43,6 +45,7 @@ if conf.get('HAVE_GLIB', 0) == 1 output: target, command: help2man_command, depends: [hb_view], + env: help2man_env, install: true, install_dir: get_option('mandir') / 'man1', ) @@ -84,6 +87,7 @@ if conf.get('HAVE_GLIB', 0) == 1 output: target, command: help2man_command, depends: [binary], + env: help2man_env, install: true, install_dir: get_option('mandir') / 'man1', ) diff --git a/util/options.hh b/util/options.hh index e4700429a..f87e8bcba 100644 --- a/util/options.hh +++ b/util/options.hh @@ -168,26 +168,31 @@ struct option_parser_t { GString *s = g_string_new (description); - // Exit codes - assert (exit_codes->len); - g_string_append_printf (s, "\n\n*Exit Codes*\n"); - for (unsigned i = 0; i < exit_codes->len; i++) - if (exit_codes->pdata[i]) - g_string_append_printf (s, "\n %u: %s\n", i, (const char *) exit_codes->pdata[i]); - - // Environment variables if any - if (environs->len) + const char *env = getenv ("HB_UTIL_HELP_VERBOSE"); + bool verbose = env && atoi (env); + if (verbose) { - g_string_append_printf (s, "\n\n*Environment*\n"); - for (unsigned i = 0; i < environs->len; i++) - { - g_string_append_printf (s, "\n %s\n", (char *)environs->pdata[i]); - } - } + // Exit codes + assert (exit_codes->len); + g_string_append_printf (s, "\n\n*Exit Codes*\n"); + for (unsigned i = 0; i < exit_codes->len; i++) + if (exit_codes->pdata[i]) + g_string_append_printf (s, "\n %u: %s\n", i, (const char *) exit_codes->pdata[i]); - // See also - g_string_append_printf (s, "\n\n*See also*\n"); - g_string_append_printf (s, " hb-view(1), hb-shape(1), hb-subset(1), hb-info(1)"); + // Environment variables if any + if (environs->len) + { + g_string_append_printf (s, "\n\n*Environment*\n"); + for (unsigned i = 0; i < environs->len; i++) + { + g_string_append_printf (s, "\n %s\n", (char *)environs->pdata[i]); + } + } + + // See also + g_string_append_printf (s, "\n\n*See also*\n"); + g_string_append_printf (s, " hb-view(1), hb-shape(1), hb-subset(1), hb-info(1)"); + } // Footer g_string_append_printf (s, "\n\nFind more information or report bugs at \n");