]> git.e2factory.org Git - e2factory.git/commitdiff
e2tool: add root() as replacement for info.root
authorTobias Ulmer <tu@emlix.com>
Fri, 20 Jan 2017 12:43:52 +0000 (13:43 +0100)
committerTobias Ulmer <tu@emlix.com>
Mon, 30 Jan 2017 13:33:34 +0000 (14:33 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/e2tool.lua

index b325527ba271801b579a5a903803d3c421a94314..d65f20e00eb1a55e5d88967d93d657cd3b7ab209 100644 (file)
@@ -701,7 +701,6 @@ function e2tool.info()
 end
 
 local _current_tool
-
 --- Get current local tool name.
 -- @param tool Optional new tool name.
 -- @return Tool name
@@ -716,6 +715,20 @@ function e2tool.current_tool(tool)
     return _current_tool
 end
 
+local _project_root
+--- Get (set) project root.
+-- @param project_root Optional. Set to specify project root.
+-- @return Project root directory.
+function e2tool.root(project_root)
+    if project_root then
+        assertIsStringN(project_root)
+        _project_root = project_root
+    end
+
+    assertIsStringN(_project_root)
+    return _project_root
+end
+
 --- initialize the local library, load and initialize local plugins
 -- @param path string: path to project tree (optional)
 -- @param tool string: tool name (without the 'e2-' prefix)