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

organized flags in man page according to logical section? #1022

Closed
BurntSushi opened this issue Aug 20, 2018 · 4 comments · Fixed by #1023
Closed

organized flags in man page according to logical section? #1022

BurntSushi opened this issue Aug 20, 2018 · 4 comments · Fixed by #1023
Labels
question An issue that is lacking clarity on one or more points.

Comments

@BurntSushi
Copy link
Owner

The number of flags ripgrep has is truly staggering. A quick count appears to put it at 80. Right now, these flags are listed alphabetically in the man page. I'm wondering whether it would be better to group them into logical sections.

For example, when PCRE2 support is enabled with the --pcre2, its Unicode support is enabled by default. ripgrep provides a flag, --no-pcre2-unicode, to disable PCRE2's Unicode support. However, the man page lists this as --pcre2-unicode, and states that it is enabled by default and can be disabled by using --no-pcre2-unicode. I did it this way so that the flag would be "discoverable" next to the --pcre2 flag. But perhaps the better thing to do here is to just group flags.

I am somewhat inspired to do this based on ripgrep's zsh completion script, which defines its own groups. I'm not sure we want to make the groups in the man page as granular as that, but with the number of flags ripgrep has, it seems like a decent idea.

@okdana I'm especially interested to hear your opinion on this. :-)

@BurntSushi BurntSushi added the question An issue that is lacking clarity on one or more points. label Aug 20, 2018
@okdana
Copy link
Contributor

okdana commented Aug 20, 2018

Hmm.

I personally find it useful to be able to scan through man pages alphabetically when i don't know the name of an option or i just want to learn about the tool's feature set. The worst man page i can think of is the one for rsync, which like rg has a million options, but unlike rg there is no immediately discernible order to them in the manual. (Close inspection reveals that they're grouped roughly by functionality — e.g., all of the options related to symlinks and hard links are together — but there are way too many groups and they're not labelled.) Trying to browse through it is a nightmare, it's unreal.

Honestly, i feel a bit hypocritical even about the grouping in the zsh function, because one of my first complaints about the old one was that the options were arranged in an order that wasn't obvious to me. I fixed that in my first rewrite, but now it's ended up kind of back where it was. (e.g., there's no reason that anyone looking at that function should expect to find --vimgrep listed under p.) But it's functional, so we'll live with it i guess.

Anyway... what i'm getting at is that i think grouping them into sections would be an improvement if their number is kept fairly low. Like if we stuck to maybe five broad categories — 'output options', 'file options', 'pattern options'.... Something like that. I feel like that would accomplish the goal of grouping related functionality together without compromising browsability. Once you start to get loads of categories you have to think about how to order the categories themselves, precisely what names to give them, whether there's overlap amongst them, &c. It's not bad if it's just a handful.

@BurntSushi
Copy link
Owner Author

Yeah, I hear ya. Those are good points. I think that's kind of why I went to the alphabetical strategy in the first place. I think the options used to be in groups ("common" and "less common" ring a bell), and I could never predict where a flag should be. I can see that happening with any number of groups unfortunately.

Maybe the right thing to do here is to leave the man page as is and (automatically generate) another doc listing the flags according to some grouping mechanism. Still not a huge fan of that either to be honest. Hmm.

@okdana
Copy link
Contributor

okdana commented Aug 20, 2018

Some very complex tools like Perl and zsh break their documentation up into totally separate man pages, which i guess is kind of a similar idea, but i don't think rg is anywhere near complicated enough for that.

Another thing that some tools do is take an optional argument to --help, so if you did have a way to produce output both with and without categories, you could provide something like --help=with-categories or whatever. But honestly i suspect most people don't feel strongly about it either way. I doubt you'd get many complaints if you just changed it (within reason obv).

@BurntSushi
Copy link
Owner Author

BurntSushi commented Aug 21, 2018

Thinking about this more, yeah, I think I want to keep the flag listing alphabetical. Another approach to solving my original problem is to simply list out "related" flags in certain places. e.g., The docs for --pcre2 could mention --no-pcre2-unicode (presuming we switch to that as the canonical flag for consistency).

BurntSushi added a commit that referenced this issue Aug 22, 2018
Previously, we used --pcre2-unicode as the canonical flag despite the
fact that it is enabled by default, which is inconsistent with how we
handle other similar flags.

The reason why --pcre2-unicode was made the canonical flag was to make
it easier to discover since it would be sorted near the --pcre2 flag. To
solve that problem, we simply start a convention that lists related
flags in the docs.

Fixes #1022
BurntSushi added a commit that referenced this issue Aug 22, 2018
Previously, we used --pcre2-unicode as the canonical flag despite the
fact that it is enabled by default, which is inconsistent with how we
handle other similar flags.

The reason why --pcre2-unicode was made the canonical flag was to make
it easier to discover since it would be sorted near the --pcre2 flag. To
solve that problem, we simply start a convention that lists related
flags in the docs.

Fixes #1022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question An issue that is lacking clarity on one or more points.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants