power-utils: Add --compare option
This option is to get a latest version from a list of PSU versions.
Due to the --compare option requires a list of strings and only one
option is supported at the same time, it's easier to switch to CLI11 to
parse the arguments.
Also add --raw option that outputs the text without linefeed.
Tested: Verify both --get-version and --compare works on Witherspoon.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Idec75e3a5699eba8ba587e74824431993fe10c4c
diff --git a/tools/power-utils/version.hpp b/tools/power-utils/version.hpp
index 26f0ce6..c10071a 100644
--- a/tools/power-utils/version.hpp
+++ b/tools/power-utils/version.hpp
@@ -16,6 +16,7 @@
#pragma once
#include <string>
+#include <vector>
namespace version
{
@@ -24,7 +25,18 @@
* Get the software version of the PSU
*
* @param[in] psuInventoryPath - The inventory path of the PSU
+ *
+ * @return The version of the PSU
*/
std::string getVersion(const std::string& psuInventoryPath);
+/**
+ * Get the latest version from a list of versions
+ *
+ * @param[in] versions - The list of PSU version strings
+ *
+ * @return The latest version
+ */
+std::string getLatest(const std::vector<std::string>& versions);
+
} // namespace version