summaryrefslogtreecommitdiff
path: root/xmake/scripts/action/_lua.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-12-05 20:38:26 +0800
committerruki <[email protected]>2015-12-05 20:38:40 +0800
commitf77eb028a770969a3e87af41e41fe1e66b3b7842 (patch)
treebb9b7d8a63c26b4446fded0028bfcd10fdd67d71 /xmake/scripts/action/_lua.lua
parentb753c9e182813b395dd4910476ff4fb3c5e26fd9 (diff)
load config for the lua action
Diffstat (limited to 'xmake/scripts/action/_lua.lua')
-rw-r--r--xmake/scripts/action/_lua.lua29
1 files changed, 26 insertions, 3 deletions
diff --git a/xmake/scripts/action/_lua.lua b/xmake/scripts/action/_lua.lua
index 9c37d461a..c1a89dc39 100644
--- a/xmake/scripts/action/_lua.lua
+++ b/xmake/scripts/action/_lua.lua
@@ -35,8 +35,23 @@ local platform = require("platform/platform")
-- need access to the given file?
function _lua.need(name)
- -- no accessors
- return false
+ -- the options
+ local options = xmake._OPTIONS
+ assert(options)
+
+ -- do not load config if be not given -f or -P options
+ if options.file == nil and options.project == nil then
+ return false
+ end
+
+ -- patch target for loading config ok
+ options.target = "all"
+
+ -- the accessors
+ local accessors = { config = true, global = true, platform = true }
+
+ -- need it?
+ return accessors[name]
end
-- done
@@ -124,7 +139,15 @@ function _lua.menu()
-- options
, options =
{
- {'s', "string", "k", nil, "Run the lua string script." }
+ {'f', "file", "kv", nil, "Read a given xmake.lua file." }
+ , {'P', "project", "kv", nil, "Change to the given project directory."
+ , "Search priority:"
+ , " 1. The Given Command Argument"
+ , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
+ , " 3. The Current Directory" }
+
+ , {}
+ , {'s', "string", "k", nil, "Run the lua string script." }
, {}
, {'v', "verbose", "k", nil, "Print lots of verbose information." }