summaryrefslogtreecommitdiff
path: root/xmake/core/package/addon.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-08-08 23:17:52 +0800
committerruki <[email protected]>2026-08-09 18:28:59 +0800
commitcf62f410738a7489fe052d183bcf616ecf5f7067 (patch)
treeea9d09e1d05c3a392e9f08688618a1a9663625b3 /xmake/core/package/addon.lua
parent8564ea66201d1398cb8ee5b91efc784a379c4a64 (diff)
add addon search
Diffstat (limited to 'xmake/core/package/addon.lua')
-rw-r--r--xmake/core/package/addon.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/core/package/addon.lua b/xmake/core/package/addon.lua
index d433bdf8a..78830d266 100644
--- a/xmake/core/package/addon.lua
+++ b/xmake/core/package/addon.lua
@@ -182,6 +182,25 @@ function addon.register(name, version, opt)
addon._save(addons)
end
+-- remove the given installed addon
+--
+-- @param name the addon name
+-- @return true or false and errors
+--
+function addon.remove(name)
+ local dirname = addon.dirname(name)
+ local installdir = path.join(addon.installdir(), dirname)
+ if not os.isdir(installdir) then
+ return false, string.format("addon(%s) not found!", name)
+ end
+ local ok, errors = os.rm(installdir)
+ if not ok then
+ return false, errors
+ end
+ addon.unregister(name)
+ return true
+end
+
-- unregister the given addon
function addon.unregister(name)
local dirname = addon.dirname(name)