summaryrefslogtreecommitdiff
path: root/xmake/actions/create/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-09-14 21:44:31 +0800
committerruki <[email protected]>2019-09-14 21:44:31 +0800
commit074d2607f20aa675e6835c0e31e8876d2f05da57 (patch)
tree38f795698d48e9bba30cc3091ced2782c69f0711 /xmake/actions/create/xmake.lua
parentc08df8d304703ca1153019825ac3cc378ac92e32 (diff)
improve project template
Diffstat (limited to 'xmake/actions/create/xmake.lua')
-rw-r--r--xmake/actions/create/xmake.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/xmake/actions/create/xmake.lua b/xmake/actions/create/xmake.lua
index f05a352f6..dee04b4b8 100644
--- a/xmake/actions/create/xmake.lua
+++ b/xmake/actions/create/xmake.lua
@@ -64,20 +64,27 @@ task("create")
-- import template
import("core.project.template")
- -- make description
+ -- get templates
local templates = {}
- local description = {}
for _, l in ipairs(template.languages()) do
for _, t in ipairs(template.templates(l)) do
templates[t.name] = templates[t.name] or {}
table.insert(templates[t.name], l)
end
end
+
+ -- get sorted templates
+ local templates_sorted = {}
for name, languages in pairs(templates) do
- table.insert(description, " - " .. name .. ": " .. table.concat(languages, ", "))
+ table.insert(templates_sorted, {name = name, languages = languages})
end
+ table.sort(templates_sorted, function(a, b) return a.name < b.name end)
- -- get it
+ -- make description
+ local description = {}
+ for _, t in ipairs(templates_sorted) do
+ table.insert(description, " - " .. t.name .. ": " .. table.concat(t.languages, ", "))
+ end
return description
end }