From eb098b6358005b1fe52e6efba860ab462977825e Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 22 May 2020 00:30:49 +0800 Subject: add 'xmake show' --- xmake/plugins/show/lists/toolchains.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 xmake/plugins/show/lists/toolchains.lua (limited to 'xmake/plugins/show/lists/toolchains.lua') diff --git a/xmake/plugins/show/lists/toolchains.lua b/xmake/plugins/show/lists/toolchains.lua new file mode 100644 index 000000000..a1b7008e3 --- /dev/null +++ b/xmake/plugins/show/lists/toolchains.lua @@ -0,0 +1,29 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-2020, TBOOX Open Source Group. +-- +-- @author ruki +-- @file toolchains.lua +-- + +-- imports +import("core.platform.platform") + +-- get all toolchains +function main() + for _, name in ipairs(platform.toolchains()) do + print(name) + end +end -- cgit v1.3.1 From 3f25af48131cf74e2ce5dc291b7427a2b3a48e01 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 22 May 2020 00:32:41 +0800 Subject: impl xmake show toolchains --- xmake/plugins/show/lists/toolchains.lua | 11 ++++++++--- xmake/plugins/show/showlist.lua | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 xmake/plugins/show/showlist.lua (limited to 'xmake/plugins/show/lists/toolchains.lua') diff --git a/xmake/plugins/show/lists/toolchains.lua b/xmake/plugins/show/lists/toolchains.lua index a1b7008e3..30897559e 100644 --- a/xmake/plugins/show/lists/toolchains.lua +++ b/xmake/plugins/show/lists/toolchains.lua @@ -19,11 +19,16 @@ -- -- imports +import("core.base.option") import("core.platform.platform") +import(".showlist") --- get all toolchains +-- show all toolchains function main() - for _, name in ipairs(platform.toolchains()) do - print(name) + if option.get("verbose") then + -- TODO show description + showlist(platform.toolchains()) + else + showlist(platform.toolchains()) end end diff --git a/xmake/plugins/show/showlist.lua b/xmake/plugins/show/showlist.lua new file mode 100644 index 000000000..88176f9ad --- /dev/null +++ b/xmake/plugins/show/showlist.lua @@ -0,0 +1,30 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-2020, TBOOX Open Source Group. +-- +-- @author ruki +-- @file showlist.lua +-- + +-- imports +import("core.base.option") + +-- show values +function main(values) + -- TODO use text.table + for _, value in ipairs(values) do + print(value) + end +end -- cgit v1.3.1 From e702326e0c1a25ad6e10ab31864b8a9f991606c7 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 22 May 2020 00:49:11 +0800 Subject: improve to show list --- xmake/plugins/show/lists/toolchains.lua | 7 +------ xmake/plugins/show/showlist.lua | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'xmake/plugins/show/lists/toolchains.lua') diff --git a/xmake/plugins/show/lists/toolchains.lua b/xmake/plugins/show/lists/toolchains.lua index 30897559e..1a288859f 100644 --- a/xmake/plugins/show/lists/toolchains.lua +++ b/xmake/plugins/show/lists/toolchains.lua @@ -25,10 +25,5 @@ import(".showlist") -- show all toolchains function main() - if option.get("verbose") then - -- TODO show description - showlist(platform.toolchains()) - else - showlist(platform.toolchains()) - end + showlist(platform.toolchains()) end diff --git a/xmake/plugins/show/showlist.lua b/xmake/plugins/show/showlist.lua index 88176f9ad..acd7e2587 100644 --- a/xmake/plugins/show/showlist.lua +++ b/xmake/plugins/show/showlist.lua @@ -20,11 +20,21 @@ -- imports import("core.base.option") +import("core.base.text") -- show values function main(values) - -- TODO use text.table + local tbl = {align = 'l', sep = " "} + local row = {} for _, value in ipairs(values) do - print(value) + table.insert(row, value) + if #row > 10 then + table.insert(tbl, row) + row = {} + end end + if #row > 0 then + table.insert(tbl, row) + end + print(text.table(tbl)) end -- cgit v1.3.1 From f216efbfd66a9e72ed423d34f28c17243190ac70 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 22 May 2020 22:50:15 +0800 Subject: improve to show toolchains --- xmake/plugins/show/lists/toolchains.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'xmake/plugins/show/lists/toolchains.lua') diff --git a/xmake/plugins/show/lists/toolchains.lua b/xmake/plugins/show/lists/toolchains.lua index 1a288859f..911fd801c 100644 --- a/xmake/plugins/show/lists/toolchains.lua +++ b/xmake/plugins/show/lists/toolchains.lua @@ -20,10 +20,15 @@ -- imports import("core.base.option") +import("core.project.project") import("core.platform.platform") import(".showlist") -- show all toolchains function main() - showlist(platform.toolchains()) + local names = table.copy(platform.toolchains()) + for name, _ in pairs(project.toolchains()) do + table.insert(names, name) + end + showlist(names) end -- cgit v1.3.1