From 6be197739af547f9b34021ff5564b9ebe56803ca Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Thu, 17 Feb 2022 18:38:23 +0100 Subject: [PATCH] Sort parameter output by name --- src/raspberrypi/rasctl_display.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/raspberrypi/rasctl_display.cpp b/src/raspberrypi/rasctl_display.cpp index 3d2190ae..a7258e45 100644 --- a/src/raspberrypi/rasctl_display.cpp +++ b/src/raspberrypi/rasctl_display.cpp @@ -304,7 +304,10 @@ void RasctlDisplay::DisplayOperationInfo(const PbOperationInfo& operation_info) } cout << endl; - for (const auto& parameter : operation.second.parameters()) { + list sorted_parameters = { operation.second.parameters().begin(), operation.second.parameters().end() }; + sorted_parameters.sort([](const auto& a, const auto& b) { return a.name() < b.name(); }); + + for (const auto& parameter : sorted_parameters) { cout << " " << parameter.name() << ": " << (parameter.is_mandatory() ? "mandatory" : "optional"); if (!parameter.description().empty()) {