feat(lib): make it possible to override interactivity state externally

Libraries that depend on toolchainlib can now set `_G.interactive`
manually and have that option be respected.
This commit is contained in:
Erica Marigold 2025-01-22 12:16:20 +05:30
parent c85c895408
commit 13cae3a375
Signed by: DevComp
GPG key ID: 429EF1C337871656

View file

@ -164,7 +164,7 @@ local function getGithubToken(): Option<string>
end
-- Initialize the shared global progress bar state
_G.interactive = false
_G.interactive = nil
local barFns
function installTool(tool: ToolId, installPath: pathfs.Path): number
@ -359,7 +359,9 @@ return setmetatable(
} :: LibExports,
{
__call = function(lib: LibExportsImpl, tool: string, pesdeRoot: string?): number
if _G.interactive == nil then
_G.interactive = true
end
local repo, version = string.match(tool, "([^@]+)@?(.*)")
if repo == nil or version == nil then