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: Sort by visibility #215

Closed
RagnarGrootKoerkamp opened this issue Nov 10, 2023 · 3 comments · Fixed by #218
Closed

feat: Sort by visibility #215

RagnarGrootKoerkamp opened this issue Nov 10, 2023 · 3 comments · Fixed by #218

Comments

@RagnarGrootKoerkamp
Copy link

Thanks for this great tool! It's a great way for me to check what types I'm exporting once a crate is done.

This would be slightly easier to do if it were possible to sort the generate tree output by (decreasing) visibility, so that all pub items come first.

Would you accept a PR to add maybe a --sort-by-visibility flag?

I could also see use for a --pub-only flag that only shows items that are externally visible.

@regexident
Copy link
Owner

Hi @RagnarGrootKoerkamp, thanks for the feature request!

Both, --sort-by-visibility and --pub-only seem like a well-motivated suggestion to me. However I try to avoid one-off features and/or options to the CLI tool, preferring more generalized approaches.

As such rather than --sort-by-visibility, I would instead prefer adding --sort-by <SORT_KEY> option, which I just did with #218.

As for --pub-only I would prefer something along a more general --filter-by. But this needs a bit more thinking. Please feel free to open a separate feature request for being able to filter the output (e.g. by visibility).

@regexident
Copy link
Owner

@RagnarGrootKoerkamp version 0.11.0 has just been published with support for sorting the output of the generate tree command via --sort-by <KEY> (where <KEY> is one of name, visibility, or kind) and --sort-reversed CLI options.

@RagnarGrootKoerkamp
Copy link
Author

I just tried it and --sort-by visibility looks great, thanks for implementing this!
Good idea to also add --sort-by kind, I was thinking of that as well at some point.

--pub-only seems less necessary now, since sorting public items at the top already gives me a very good overview of exported items anyway.

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 a pull request may close this issue.

2 participants