summaryrefslogtreecommitdiff
path: root/xmake/core/base
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-30 23:21:24 +0800
committerruki <[email protected]>2026-03-30 23:21:24 +0800
commite23dc968df5fa84e24e98a7fff903e40a12d6624 (patch)
treeaef2534021d1f05309ee679a37ada11ae78369ff /xmake/core/base
parent637efd500cc64421601aba5d0382616114e5dfcf (diff)
update more comments
Diffstat (limited to 'xmake/core/base')
-rw-r--r--xmake/core/base/filter.lua22
1 files changed, 18 insertions, 4 deletions
diff --git a/xmake/core/base/filter.lua b/xmake/core/base/filter.lua
index dae397e4e..0312c4fa5 100644
--- a/xmake/core/base/filter.lua
+++ b/xmake/core/base/filter.lua
@@ -33,7 +33,10 @@ local scheduler = require("base/scheduler")
local escape_table1 = {["$"] = "\001", ["("] = "\002", [")"] = "\003", ["%"] = "\004"}
local escape_table2 = {["\001"] = "$", ["\002"] = "(", ["\003"] = ")", ["\004"] = "%"}
--- new filter instance
+-- create a new filter instance for variable substitution
+--
+-- @return the filter instance
+--
function filter.new()
-- init an filter instance
@@ -51,7 +54,10 @@ end
-- e.g.
--
-- print("$(shell echo hello xmake)")
--- add_ldflags("$(shell pkg-config --libs sqlite3)")
+-- execute shell command and return output for $(shell ...) substitution
+--
+-- @param cmd the shell command
+-- @return the command output string
--
function filter.shell(cmd)
@@ -77,12 +83,20 @@ function filter.shell(cmd)
return outdata
end
--- filter the environment variables
+-- get environment variable value for $(env ...) substitution
+--
+-- @param name the environment variable name
+-- @return the environment value
+--
function filter.env(name)
return os.getenv(name)
end
--- filter the winreg path
+-- query windows registry value for $(reg ...) substitution
+--
+-- @param path the registry path
+-- @return the registry value
+--
function filter.reg(path)
-- must be windows