From 02e22fee1e166b95778c51d7322591905bb6ad9d Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 24 Oct 2020 20:56:39 +0800 Subject: improve xrepo action order --- xmake/modules/private/xrepo/main.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/xmake/modules/private/xrepo/main.lua b/xmake/modules/private/xrepo/main.lua index e11f656f0..5e54758a6 100644 --- a/xmake/modules/private/xrepo/main.lua +++ b/xmake/modules/private/xrepo/main.lua @@ -61,11 +61,24 @@ function _menu_options() print("") cprint("${bright}Actions:") + -- get action names + local repo_actions = {} + local package_actions = {} + for _, scriptfile in ipairs(os.files(path.join(os.scriptdir(), "action", "*.lua"))) do + local action_name = path.basename(scriptfile) + if action_name:endswith("-repo") then + table.insert(repo_actions, action_name) + else + table.insert(package_actions, action_name) + end + end + table.sort(repo_actions) + table.sort(package_actions) + -- make action content local tablecontent = {} local narrow = menu_isnarrow() - for _, scriptfile in ipairs(os.files(path.join(os.scriptdir(), "action", "*.lua"))) do - local action_name = path.basename(scriptfile) + for _, action_name in ipairs(table.join(package_actions, repo_actions)) do local action = import("private.xrepo.action." .. action_name, {anonymous = true}) local _, _, description = action.menu_options() local taskline = string.format(narrow and " %s" or " %s", action_name) -- cgit v1.3.1