aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/buf/init.lua
diff options
context:
space:
mode:
authorVu Le Thanh <thanhvule0310@gmail.com>2022-08-02 19:32:01 +0700
committerGitHub <noreply@github.com>2022-08-02 14:32:01 +0200
commitb3bb9e0b8e896d203e730d980ec208fe109e1863 (patch)
tree8fc868a72032289624a498c165d295d4a9acddec /lua/mason-registry/buf/init.lua
parentfeat: add goimports (#224) (diff)
downloadmason-b3bb9e0b8e896d203e730d980ec208fe109e1863.tar
mason-b3bb9e0b8e896d203e730d980ec208fe109e1863.tar.gz
mason-b3bb9e0b8e896d203e730d980ec208fe109e1863.tar.bz2
mason-b3bb9e0b8e896d203e730d980ec208fe109e1863.tar.lz
mason-b3bb9e0b8e896d203e730d980ec208fe109e1863.tar.xz
mason-b3bb9e0b8e896d203e730d980ec208fe109e1863.tar.zst
mason-b3bb9e0b8e896d203e730d980ec208fe109e1863.zip
feat: add xo, jq, buf, joker, csharpier (#221)
Diffstat (limited to 'lua/mason-registry/buf/init.lua')
-rw-r--r--lua/mason-registry/buf/init.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/lua/mason-registry/buf/init.lua b/lua/mason-registry/buf/init.lua
new file mode 100644
index 00000000..9221c27c
--- /dev/null
+++ b/lua/mason-registry/buf/init.lua
@@ -0,0 +1,35 @@
+local Pkg = require "mason-core.package"
+local platform = require "mason-core.platform"
+local _ = require "mason-core.functional"
+local github = require "mason-core.managers.github"
+local std = require "mason-core.managers.std"
+
+local coalesce, when = _.coalesce, _.when
+
+return Pkg.new {
+ name = "buf",
+ desc = [[The Buf CLI is a one stop shop for your local Protocol Buffers needs. It comes with a linter that enforces good API designs, a breaking change detector, a generator, a formatter that formats your Protobuf files in accordance with industry standards. It also helps you manage your Protobuf assets on the Buf Schema Registry.]],
+ homepage = "https://buf.build",
+ languages = { Pkg.Lang.Protobuf },
+ categories = { Pkg.Cat.Linter, Pkg.Cat.Formatter },
+ ---@async
+ ---@param ctx InstallContext
+ install = function(ctx)
+ github
+ .download_release_file({
+ repo = "bufbuild/buf",
+ out_file = platform.is.win and "buf.exe" or "buf",
+ asset_file = coalesce(
+ when(platform.is.mac_x64, "buf-Darwin-x86_64"),
+ when(platform.is.mac_arm64, "buf-Darwin-arm64"),
+ when(platform.is.linux_x64, "buf-Linux-x86_64"),
+ when(platform.is.linux_arm64, "buf-Linux-aarch64"),
+ when(platform.is.win_arm64, "buf-Windows-arm64.exe"),
+ when(platform.is.win_x64, "buf-Windows-x86_64.exe")
+ ),
+ })
+ .with_receipt()
+ std.chmod("+x", { "buf" })
+ ctx:link_bin("buf", platform.is.win and "buf.exe" or "buf")
+ end,
+}