diff options
| -rw-r--r-- | xmake/actions/require/impl/package.lua | 20 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 5 |
2 files changed, 22 insertions, 3 deletions
diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua index d362563a4..159497b60 100644 --- a/xmake/actions/require/impl/package.lua +++ b/xmake/actions/require/impl/package.lua @@ -340,11 +340,25 @@ function _get_confirm(packages) -- get confirm local confirm = option.get("yes") if confirm == nil then - + + -- get packages for each repositories + local packages_repo = {} + for _, package in ipairs(packages) do + local reponame = package:repo() and package:repo():name() or package:fromkind() + if package:is3rd() then + reponame = package:name():lower():split("::")[1] + end + packages_repo[reponame] = packages_repo[reponame] or {} + table.insert(packages_repo[reponame], package) + end + -- show tips cprint("${bright color.warning}note: ${clear}try installing these packages (pass -y to skip confirm)?") - for _, package in ipairs(packages) do - print(" -> %s %s %s", package:name(), package:version_str() or "", package:debug() and "(debug)" or "") + for reponame, packages in pairs(packages_repo) do + print("in %s:", reponame) + for _, package in ipairs(packages) do + print(" -> %s %s %s", package:name(), package:version_str() or "", package:debug() and "(debug)" or "") + end end cprint("please input: y (y/n)") diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 1f8ed881f..8567ca95a 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -211,6 +211,11 @@ function _instance:from(kind) return self._FROMKIND == kind end +-- get from kind +function _instance:fromkind() + return self._FROMKIND +end + -- get the package kind, binary or nil(static, shared) function _instance:kind() return self:get("kind") |
