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

feat(help): accept patterns for readme #269

Merged
merged 1 commit into from
Jan 1, 2023

Conversation

MunifTanjim
Copy link
Contributor

I don't know if this PR is gonna be accepted, since I don't see many plugins having multiple README.md files in the lua/ directory.

If it doesn't go with the roadmap or if the lua/ directory handling seems too specific/hardcoded, feel free to close the PR.

Copy link
Owner

@folke folke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition! See my comments below

@@ -7,23 +7,30 @@ function M.index(plugin)
if Config.options.readme.skip_if_doc_exists and vim.loop.fs_stat(plugin.dir .. "/doc") then
return {}
end
local files = vim.tbl_flatten(vim.tbl_map(function(file)
return vim.fn.expand(plugin.dir .. "/" .. file, false, true)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also add Util.norm(vim.fn.expan...) to normalize the paths for windows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vim.fn.expand will return a list. I'm not quite sure when to normalize, should I do it after expanding? Or before? 🤔

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after should be fine. Or just do it in the loop where you loop over the files, right before where you build the tag_filename

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I tested on linux/mac. But not very confident if filename generation would work correctly on Windows.

if vim.loop.fs_stat(file) then
local tag_filename = plugin.name
if file:find("lua/") then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to make this more general. So build the filename based on everything after plugin.dir. So for example:

nui.nvim/lua/nui/popup/README.md -> nui.nvim-lua-nui-popup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@MunifTanjim MunifTanjim force-pushed the feat-help-multiple-readme branch 3 times, most recently from cd7b9de to a47792c Compare January 1, 2023 18:22
@folke folke merged commit d521a25 into folke:main Jan 1, 2023
@folke
Copy link
Owner

folke commented Jan 1, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants