aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/index/taplo/init.lua
blob: 145efd134608572f12ec63599b8e1ff4aefcb23a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
local Pkg = require "mason-core.package"
local _ = require "mason-core.functional"
local github = require "mason-core.managers.github"
local platform = require "mason-core.platform"
local std = require "mason-core.managers.std"

local coalesce, when = _.coalesce, _.when

return Pkg.new {
    name = "taplo",
    desc = [[A versatile, feature-rich TOML toolkit.]],
    homepage = "https://taplo.tamasfe.dev/",
    languages = { Pkg.Lang.TOML },
    categories = { Pkg.Cat.LSP },
    ---@async
    ---@param ctx InstallContext
    install = function(ctx)
        platform.when {
            unix = function()
                github
                    .gunzip_release_file({
                        repo = "tamasfe/taplo",
                        asset_file = coalesce(
                            when(platform.is.mac_arm64, "taplo-full-darwin-aarch64.gz"),
                            when(platform.is.mac_x64, "taplo-full-darwin-x86_64.gz"),
                            when(platform.is.linux_x64, "taplo-full-linux-x86_64.gz"),
                            when(platform.is.linux_x86, "taplo-full-linux-x86.gz"),
                            when(platform.is.linux_arm64, "taplo-full-linux-aarch64.gz")
                        ),
                        out_file = "taplo",
                    })
                    .with_receipt()
                std.chmod("+x", { "taplo" })
                ctx:link_bin("taplo", "taplo")
            end,
            win = function()
                github
                    .unzip_release_file({
                        repo = "tamasfe/taplo",
                        asset_file = coalesce(
                            when(platform.is.win_x64, "taplo-full-windows-x86_64.zip"),
                            when(platform.is.win_x86, "taplo-full-windows-x86.zip")
                        ),
                        out_file = "taplo.zip",
                    })
                    .with_receipt()
                ctx:link_bin("taplo", "taplo.exe")
            end,
        }
    end,
}