Add move command for moving (leaf)list instances
Change-Id: I0bff25209f74601a450c12a810200b3c124d65f2
diff --git a/src/utils.cpp b/src/utils.cpp
index 941fa4e..cf789b7 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -235,3 +235,20 @@
res.erase(res.find_last_of('['));
return res;
}
+
+std::string stripLastListInstanceFromPath(const std::string& path)
+{
+ auto res = path;
+ res.erase(res.find_first_of('[', res.find_last_of('/')));
+ return res;
+}
+
+std::string instanceToString(const std::string& modName, const ListInstance& instance)
+{
+ std::string instanceStr;
+ for (const auto& [key, value] : instance) {
+ using namespace std::string_literals;
+ instanceStr += "[" + modName + ":" + key + "=" + escapeListKeyString(leafDataToString(value)) + "]";
+ }
+ return instanceStr;
+}