Disallow cd out of the prepare context

Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/202
Change-Id: I8e9772ebd1fa86469e2c497b9813686b3ff361d5
diff --git a/src/interpreter.cpp b/src/interpreter.cpp
index 43e2269..8030f3f 100644
--- a/src/interpreter.cpp
+++ b/src/interpreter.cpp
@@ -89,6 +89,9 @@
 
 void Interpreter::operator()(const cd_& cd) const
 {
+    if (auto rpcInputPath = m_datastore.inputDatastorePath(); rpcInputPath && !pathToDataString(cd.m_path, Prefixes::WhenNeeded).starts_with(m_parser.currentNode())) {
+        throw std::runtime_error("Can't cd out of `prepare` context");
+    }
     m_parser.changeNode(cd.m_path);
 }