diff options
| author | ruki <[email protected]> | 2021-01-02 00:31:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-01-02 00:31:26 +0800 |
| commit | 23cf7e2df45344351c7dd30dad8742282fb74363 (patch) | |
| tree | 0febba444fb1343b358bc4f49a1275e305ecb18f /xmake/actions/require/impl/package.lua | |
| parent | 4f5075a97162ea3a23c91e3c33341baf05e207ec (diff) | |
improve confirm tips
Diffstat (limited to 'xmake/actions/require/impl/package.lua')
| -rw-r--r-- | xmake/actions/require/impl/package.lua | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua index 92ad78c7e..0f1f78277 100644 --- a/xmake/actions/require/impl/package.lua +++ b/xmake/actions/require/impl/package.lua @@ -578,6 +578,21 @@ function _sort_packages_urls(packages) end end +-- get package parents string +function _get_package_parents_str(package) + local parents = package:parents() + if parents then + local parentnames = {} + for _, parent in pairs(parents) do + table.insert(parentnames, parent:displayname()) + end + if #parentnames == 0 then + return + end + return table.concat(parentnames, ",") + end +end + -- get package configs string function _get_package_configs_str(package) local configs = {} @@ -594,8 +609,12 @@ function _get_package_configs_str(package) end end end - local configs_str = #configs > 0 and "(" .. table.concat(configs, ", ") .. ")" or "" - local limitwidth = os.getwinsize().width / 2 + local parents_str = _get_package_parents_str(package) + if parents_str then + table.insert(configs, "from:" .. parents_str) + end + local configs_str = #configs > 0 and "[" .. table.concat(configs, ", ") .. "]" or "" + local limitwidth = os.getwinsize().width * 2 / 3 if #configs_str > limitwidth then configs_str = configs_str:sub(1, limitwidth) .. " ..)" end |
