Skip to content

Commit

Permalink
feat(registry): add glow (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
WhoIsSethDaniel authored Jan 12, 2023
1 parent c609775 commit 160bd7c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
47 changes: 47 additions & 0 deletions lua/mason-registry/glow/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
local Pkg = require "mason-core.package"
local _ = require "mason-core.functional"
local platform = require "mason-core.platform"
local github = require "mason-core.managers.github"
local path = require "mason-core.path"

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

return Pkg.new {
name = "glow",
desc = [[Render markdown on the CLI, with pizzazz]],
homepage = "https://github.com/charmbracelet/glow",
languages = { Pkg.Lang.Markdown },
categories = {},
install = function(ctx)
---@param template_string string
local function release_file(template_string)
return _.compose(_.format(template_string), _.gsub("^v", ""))
end
local asset_file = coalesce(
when(platform.is.mac_arm64, release_file "glow_%s_Darwin_arm64.tar.gz"),
when(platform.is.mac_x64, release_file "glow_%s_Darwin_x86_64.tar.gz"),
when(platform.is.linux_x64_openbsd, release_file "glow_%s_openbsd_x86_64.tar.gz"),
when(platform.is.linux_arm64_openbsd, release_file "glow_%s_openbsd_arm64.tar.gz"),
when(platform.is.linux_arm64, release_file "glow_%s_linux_arm64.tar.gz"),
when(platform.is.linux_x64, release_file "glow_%s_linux_x86_64.tar.gz"),
when(platform.is.win_x86, release_file "glow_%s_Windows_i386.zip"),
when(platform.is.win_x64, release_file "glow_%s_Windows_x86_64.zip")
)
local source = platform.when {
unix = function()
return github.untargz_release_file {
repo = "charmbracelet/glow",
asset_file = asset_file,
}
end,
win = function()
return github.unzip_release_file {
repo = "charmbracelet/glow",
asset_file = asset_file,
}
end,
}
source.with_receipt()
ctx:link_bin("glow", platform.is.win and "glow.exe" or "glow")
end,
}
1 change: 1 addition & 0 deletions lua/mason-registry/index.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ return {
gersemi = "mason-registry.gersemi",
gitlint = "mason-registry.gitlint",
glint = "mason-registry.glint",
glow = "mason-registry.glow",
["go-debug-adapter"] = "mason-registry.go-debug-adapter",
gofumpt = "mason-registry.gofumpt",
goimports = "mason-registry.goimports",
Expand Down
2 changes: 1 addition & 1 deletion lua/mason/mappings/language.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ return {
liquid = { "curlylint", "shopify-theme-check" },
lua = { "lemmy-help", "lua-language-server", "luacheck", "luaformatter", "selene", "stylua" },
luau = { "luau-lsp", "selene", "stylua" },
markdown = { "alex", "cbfmt", "grammarly-languageserver", "ltex-ls", "markdownlint", "marksman", "prettier", "prettierd", "proselint", "prosemd-lsp", "remark-cli", "remark-language-server", "textlint", "vale", "write-good", "zk" },
markdown = { "alex", "cbfmt", "glow", "grammarly-languageserver", "ltex-ls", "markdownlint", "marksman", "prettier", "prettierd", "proselint", "prosemd-lsp", "remark-cli", "remark-language-server", "textlint", "vale", "write-good", "zk" },
["metamath zero"] = { "metamath-zero-lsp" },
mksh = { "shfmt" },
move = { "move-analyzer" },
Expand Down

0 comments on commit 160bd7c

Please sign in to comment.