feat: Manpages finder (output of apropos) (#134)

First edition. Sometimes weird things can happen with the previewer, but I think I got it 99% working.

* feat: Manpages finder (output of apropos)

* fixup: Add previewer and fix comments

Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
This commit is contained in:
Senghan Bright
2020-10-07 16:01:47 -04:00
committed by GitHub
co-authored by TJ DeVries
parent 2053a2621a
commit a7957b2bdc
3 changed files with 95 additions and 5 deletions
+15 -3
View File
@@ -403,15 +403,27 @@ function make_entry.gen_from_packages(opts)
return function(module_name)
local entry = {
valid = module_name ~= "",
entry_type = make_entry.types.GENERIC,
value = module_name,
ordinal = module_name,
}
}
entry.display = make_display(module_name)
return entry
end
end
function make_entry.gen_from_apropos(opts)
opts = opts or {}
return function(line)
local cmd, _, desc = line:match("^(.*)%s+%((.*)%)%s+%-%s(.*)$")
return {
value = cmd,
ordinal = cmd,
display = string.format("%-30s : %s", cmd, desc)
}
end
end
return make_entry