diff options
| author | Gly <[email protected]> | 2022-12-26 23:24:17 +0100 |
|---|---|---|
| committer | Gly <[email protected]> | 2022-12-26 23:24:17 +0100 |
| commit | 638c9e8047e45c01dce32096907be5dc9bade9c9 (patch) | |
| tree | 85cb2343da2eb658eb5aef699527d7536ebee5c4 | |
| parent | d72666d1a994cd5aea630607c61cc6e3c9f55840 (diff) | |
delete cache in xmake instof xrepo
| -rw-r--r-- | xmake/modules/private/xrepo/main.lua | 10 | ||||
| -rw-r--r-- | xmake/plugins/repo/main.lua | 20 |
2 files changed, 20 insertions, 10 deletions
diff --git a/xmake/modules/private/xrepo/main.lua b/xmake/modules/private/xrepo/main.lua index 6e5810172..986860fab 100644 --- a/xmake/modules/private/xrepo/main.lua +++ b/xmake/modules/private/xrepo/main.lua @@ -194,16 +194,6 @@ function main(...) -- do action if menu.action then menu.action() - -- on repos changed - -- we clear the cache for completion - if action_name in { - "add-repo", - "rm-repo", - "update-repo" - } then - -- init the xrepo - import("private.xrepo.quick_search.cache.clear")() - end else menu.show_help() end diff --git a/xmake/plugins/repo/main.lua b/xmake/plugins/repo/main.lua index 98262f3e9..9a1418128 100644 --- a/xmake/plugins/repo/main.lua +++ b/xmake/plugins/repo/main.lua @@ -29,6 +29,13 @@ import("net.proxy") import("private.async.runjobs") import("private.action.require.impl.environment") +function _clear_quick_search_cache(is_global) + if is_global then + import("private.xrepo.quick_search.cache") + cache.clear() + end +end + -- add repository url function _add(name, url, branch, is_global) @@ -55,6 +62,9 @@ function _add(name, url, branch, is_global) -- leave environment environment.leave() + + -- clear quick search cache + _clear_quick_search_cache(is_global) end -- remove repository url @@ -69,8 +79,12 @@ function _remove(name, is_global) os.rmdir(repodir) end + -- clear quick search cache + _clear_quick_search_cache(is_global) + -- trace cprint("${bright}remove %s repository(%s): ok!", (is_global and "global" or "local"), name) + end -- update repositories @@ -112,6 +126,9 @@ function _update() pulled[repodir] = true end end + + -- clear quick search cache + _clear_quick_search_cache(true) end -- pull repositories @@ -140,6 +157,9 @@ function _clear(is_global) os.rmdir(repodir) end + -- clear quick search cache + _clear_quick_search_cache(is_global) + -- trace cprint("${color.success}clear %s repositories: ok!", (is_global and "global" or "local")) end |
