mirror of
https://github.com/pesde-pkg/tooling.git
synced 2025-01-10 08:19:10 +00:00
fix(lib): handle result conditionally too
Previously, we were calling `:unwrap` while trying to increment the progress bar even if we were not in an interactive environment. This fixes that.
This commit is contained in:
parent
35fb2df3a4
commit
aba182cea5
1 changed files with 9 additions and 7 deletions
|
@ -130,7 +130,9 @@ local function makeConditionalBar()
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
next = makeConditional(bar.nextStage),
|
next = makeConditional(function(bar)
|
||||||
|
return bar:nextStage():unwrap()
|
||||||
|
end),
|
||||||
start = makeConditional(bar.start),
|
start = makeConditional(bar.start),
|
||||||
stop = makeConditional(bar.stop),
|
stop = makeConditional(bar.stop),
|
||||||
}
|
}
|
||||||
|
@ -162,7 +164,7 @@ function installTool(tool: ToolId, installPath: pathfs.Path): number
|
||||||
}) :: Option<Github.Config>
|
}) :: Option<Github.Config>
|
||||||
)
|
)
|
||||||
|
|
||||||
barFns.next(bar):unwrap() -- fetch
|
barFns.next(bar) -- fetch
|
||||||
local releases = client:queueTransactions({ "FetchReleases" })[1]:unwrap() :: GithubReleases
|
local releases = client:queueTransactions({ "FetchReleases" })[1]:unwrap() :: GithubReleases
|
||||||
local assets = tool.version:match({
|
local assets = tool.version:match({
|
||||||
Some = function(version: string)
|
Some = function(version: string)
|
||||||
|
@ -180,7 +182,7 @@ function installTool(tool: ToolId, installPath: pathfs.Path): number
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
barFns.next(bar):unwrap() -- locate
|
barFns.next(bar) -- locate
|
||||||
-- TODO: Use index type fn in solver v2
|
-- TODO: Use index type fn in solver v2
|
||||||
local matchingAsset: {
|
local matchingAsset: {
|
||||||
name: string,
|
name: string,
|
||||||
|
@ -204,7 +206,7 @@ function installTool(tool: ToolId, installPath: pathfs.Path): number
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
barFns.next(bar):unwrap() -- download
|
barFns.next(bar) -- download
|
||||||
|
|
||||||
local binaryPath: pathfs.Path
|
local binaryPath: pathfs.Path
|
||||||
if matchingAsset == nil then
|
if matchingAsset == nil then
|
||||||
|
@ -235,7 +237,7 @@ function installTool(tool: ToolId, installPath: pathfs.Path): number
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
barFns.next(bar):unwrap() -- install
|
barFns.next(bar) -- install
|
||||||
|
|
||||||
-- Maintain multiple versions of a tool, and avoid downloading
|
-- Maintain multiple versions of a tool, and avoid downloading
|
||||||
-- the binary for a version again if it's already there
|
-- the binary for a version again if it's already there
|
||||||
|
|
Loading…
Reference in a new issue