Allow specifying target for get

Change-Id: I4d8c6e7e445a613a384ef16f06448c101e37abcc
diff --git a/src/interpreter.cpp b/src/interpreter.cpp
index 8030f3f..0fe96da 100644
--- a/src/interpreter.cpp
+++ b/src/interpreter.cpp
@@ -10,6 +10,7 @@
 #include <boost/mpl/for_each.hpp>
 #include <iostream>
 #include <sstream>
+#include "UniqueResource.hpp"
 #include "datastore_access.hpp"
 #include "interpreter.hpp"
 #include "utils.hpp"
@@ -83,6 +84,14 @@
 
 void Interpreter::operator()(const get_& get) const
 {
+    auto targetSwitcher = make_unique_resource([] {}, [this, oldTarget = m_datastore.target()] {
+        m_datastore.setTarget(oldTarget);
+    });
+
+    if (get.m_dsTarget) {
+        m_datastore.setTarget(*get.m_dsTarget);
+    }
+
     auto items = m_datastore.getItems(pathToString(toCanonicalPath(get.m_path)));
     printTree(items);
 }