summaryrefslogtreecommitdiff
path: root/xmake/core/base/task.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-30 23:11:44 +0800
committerruki <[email protected]>2026-03-30 23:11:44 +0800
commite8d7d0dfdcb0b3076ed2c26a1324f77d188e43c7 (patch)
treed22c8e56f8fa843988db9a081d65a51ac2b36546 /xmake/core/base/task.lua
parent21760e232a003e32f6ac10099a603a6366eb6aca (diff)
update comments
Diffstat (limited to 'xmake/core/base/task.lua')
-rw-r--r--xmake/core/base/task.lua24
1 files changed, 20 insertions, 4 deletions
diff --git a/xmake/core/base/task.lua b/xmake/core/base/task.lua
index 29cca38f2..27ad5023a 100644
--- a/xmake/core/base/task.lua
+++ b/xmake/core/base/task.lua
@@ -365,7 +365,12 @@ function task.apis()
}
end
--- new a task instance
+-- create a new task instance
+--
+-- @param name the task name
+-- @param info the task info table
+-- @return the task instance
+--
function task.new(name, info)
local instance = table.inherit(task)
if name then
@@ -380,7 +385,10 @@ function task.new(name, info)
return instance
end
--- get global tasks
+-- get all registered tasks
+--
+-- @return the tasks table {name = task, ...}
+--
function task.tasks()
if task._TASKS then
return task._TASKS
@@ -410,12 +418,20 @@ function task.tasks()
return instances
end
--- get the given global task
+-- get the given task by name
+--
+-- @param name the task name
+-- @return the task instance, or nil if not found
+--
function task.task(name)
return task.tasks()[name]
end
--- get the task menu
+-- get the task menu for command line parsing
+--
+-- @param tasks the tasks table (optional, default all tasks)
+-- @return the menu table
+--
function task.menu(tasks)
local menu = {}
for taskname, taskinst in pairs(tasks) do