Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: man_pages on macOS 13 and FreeBSD #2326 #2352

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lua/telescope/builtin/__internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,16 @@ internal.man_pages = function(opts)
opts.sections = vim.F.if_nil(opts.sections, { "1" })
assert(vim.tbl_islist(opts.sections), "sections should be a list")
opts.man_cmd = utils.get_lazy_default(opts.man_cmd, function()
local is_darwin = vim.loop.os_uname().sysname == "Darwin"
return is_darwin and { "apropos", " " } or { "apropos", "" }
local uname = vim.loop.os_uname()
local sysname = string.lower(uname.sysname)
if sysname == "darwin" then
local major_version = tonumber(vim.fn.matchlist(uname.release, [[^\(\d\+\)\..*]])[2]) or 0
return major_version >= 22 and { "apropos", "." } or { "apropos", " " }
elseif sysname == "freebsd" then
return { "apropos", "." }
else
return { "apropos", "" }
end
end)
opts.entry_maker = opts.entry_maker or make_entry.gen_from_apropos(opts)
opts.env = { PATH = vim.env.PATH, MANPATH = vim.env.MANPATH }
Expand Down