aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/taplo/init.lua
blob: d22c837de09b8f09c4cf2a0ef558e0abe1ca746c (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
local Pkg = require "mason-core.package"
local cargo = require "mason-core.managers.cargo"
local github = require "mason-core.managers.github"
local _ = require "mason-core.functional"
local platform = require "mason-core.platform"

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)
        local asset_file = coalesce(
            when(platform.is.mac, "taplo-full-x86_64-apple-darwin-gnu.tar.gz"),
            when(platform.is.linux_x64, "taplo-full-x86_64-unknown-linux-gnu.tar.gz")
        )
        if asset_file then
            github
                .untargz_release_file({
                    repo = "tamasfe/taplo",
                    asset_file = asset_file,
                })
                .with_receipt()
            ctx:link_bin("taplo", "taplo")
        else
            cargo.crate("taplo-cli", {
                features = "lsp,toml-test",
                bin = { "taplo" },
            })
        end
    end,
}