diff options
Diffstat (limited to 'absl/flags')
-rw-r--r-- | absl/flags/internal/usage.cc | 17 | ||||
-rw-r--r-- | absl/flags/internal/usage_test.cc | 3 |
2 files changed, 4 insertions, 16 deletions
diff --git a/absl/flags/internal/usage.cc b/absl/flags/internal/usage.cc index a883567f..949709e8 100644 --- a/absl/flags/internal/usage.cc +++ b/absl/flags/internal/usage.cc @@ -17,7 +17,6 @@ #include <stdint.h> -#include <algorithm> #include <functional> #include <map> #include <ostream> @@ -256,6 +255,9 @@ void FlagsHelpImpl(std::ostream& out, PerFlagFilter filter_cb, matching_flags; flags_internal::ForEachFlag([&](absl::CommandLineFlag& flag) { + // Ignore retired flags. + if (flag.IsRetired()) return; + // If the flag has been stripped, pretend that it doesn't exist. if (flag.Help() == flags_internal::kStrippedFlagHelp) return; @@ -273,14 +275,6 @@ void FlagsHelpImpl(std::ostream& out, PerFlagFilter filter_cb, absl::string_view file_separator; // controls blank lines between files for (auto& package : matching_flags) { if (format == HelpFormat::kHumanReadable) { - // Hide packages with only retired flags - bool all_package_flags_are_retired = true; - for (const auto& flags_in_file : package.second) { - for (const auto* flag : flags_in_file.second) { - all_package_flags_are_retired &= flag->IsRetired(); - } - } - if (all_package_flags_are_retired) continue; out << package_separator; package_separator = "\n\n"; } @@ -340,11 +334,8 @@ void FlagsHelpImpl(std::ostream& out, // Produces the help message describing specific flag. void FlagHelp(std::ostream& out, const CommandLineFlag& flag, HelpFormat format) { - if (format == HelpFormat::kHumanReadable) { - // Ignore retired flags - if (flag.IsRetired()) return; + if (format == HelpFormat::kHumanReadable) flags_internal::FlagHelpHumanReadable(flag, out); - } } // -------------------------------------------------------------------- diff --git a/absl/flags/internal/usage_test.cc b/absl/flags/internal/usage_test.cc index 5055640a..044d71c8 100644 --- a/absl/flags/internal/usage_test.cc +++ b/absl/flags/internal/usage_test.cc @@ -61,9 +61,6 @@ ABSL_FLAG( "Even more long long long long long long long long long long long long " "help message."); -ABSL_RETIRED_FLAG(int64_t, usage_reporting_test_flag_07, 1, - "usage_reporting_test_flag_07 help message"); - namespace { namespace flags = absl::flags_internal; |