From cf62f410738a7489fe052d183bcf616ecf5f7067 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 8 Aug 2026 23:17:52 +0800 Subject: add addon search --- xmake/core/package/addon.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'xmake/core/package/addon.lua') 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) -- cgit v1.3.1