diff options
| author | ruki <[email protected]> | 2020-10-24 20:56:39 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-10-24 20:56:39 +0800 |
| commit | 02e22fee1e166b95778c51d7322591905bb6ad9d (patch) | |
| tree | 3e46e12e6a4708275f2c7b442a2848715a14e1d6 | |
| parent | 3b47ed2bc4b9a9ee1a55f63a8b92b4a3ebde5b96 (diff) | |
improve xrepo action order
| -rw-r--r-- | xmake/modules/private/xrepo/main.lua | 17 |
1 files 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) |
