Skip to content

Commit 3a3cca3

Browse files
committed
Add lean.elan.toolchain.gc support.
(Without --delete at the minute.)
1 parent b0adc8d commit 3a3cca3

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lua/lean/elan.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ local elan = { toolchain = {} }
2222
---@field path string the path to the toolchain on this machine
2323
---@field resolved_name string the identifier for this toolchain
2424

25+
---Information about a toolchain which is in use by a project on the machine.
26+
---@class ElanUsedToolchain
27+
---@field toolchain string the name of the toolchain
28+
---@field user string a path (or in some cases reason) that causes the toolchain to be considered in-use
29+
30+
---Determine which toolchains are in use.
31+
---@return string[] unused the unused toolchains currently installed
32+
---@return ElanUsedToolchain[] used any used toolchains
33+
function elan.toolchain.gc()
34+
local stdout = subprocess_check_output { 'elan', 'toolchain', 'gc', '--json' }
35+
local result = vim.json.decode(stdout)
36+
return result.unused_toolchains, result.used_toolchains
37+
end
38+
2539
---List the installed toolchains.
2640
---@return string[] toolchains the toolchains
2741
function elan.toolchain.list()

0 commit comments

Comments
 (0)