serenity icon indicating copy to clipboard operation
serenity copied to clipboard

man: Implement dynamic manpage titles

Open chasestruck opened this issue 3 years ago • 7 comments

This patch has man(1) dynamically set the title of the manpage based on what section of the manpages you are reading from.

If you are reading from man1/, the title is: SerenityOS User Manual

If you are reading from man2/, man3/, or man4/, the title is: SerenityOS System Programmer's Manual

If you are reading from man5/, the title is: SerenityOS File Formats Manual

If you are reading from man6/, the title is: SerenityOS Games Manual

If you are reading from man7/, the title is: SerenityOS Miscellaneous Information Manual

Finally, if you are reading from man8/, the title is: SerenityOS System Administration Manual

chasestruck avatar Jun 11 '22 05:06 chasestruck

We already have those name strings in the codebase at various locations, in code here for example. Maybe instead of duplicating another time that logic could be shared

networkException avatar Jun 11 '22 09:06 networkException

So, I avoided something like that here because I wasn't aiming for a 1:1 correlation between these manpage titles and the actual categories. Hence why 3 sections are grouped together under one generic title and some titles use different phrasing. If we want 1:1 correlation I could go ahead and use those strings. Only thing is that if we do want that, wouldn't it be awkward to have man(1) depend on help(1)? I can't find any other file that has these strings in them.

chasestruck avatar Jun 11 '22 18:06 chasestruck

Only thing is that if we do want that, wouldn't it be awkward to have man(1) depend on help(1)? I can't find any other file that has these strings in them.

You would ideally put it in some shared library (like LibCore, or AK, A new library? etc..) and then use it from both locations. I agree with networkException, it would be nice to have them synchronized across the codebase. More consistency, and less debt long term.

bgianfo avatar Jun 14 '22 00:06 bgianfo

The title names now follow a format of SerenityOS {category} Manual, where {category} is the category of the manpage you are reading. Thus, a 1:1 correlation between these titles and the manpage categories.

The name strings are still not shared between man(1) and help(1). I asked Linus on Discord and he said this was fine for now but that in the future we might want to look into creating a library to (among other things) share the name strings.

chasestruck avatar Jun 14 '22 02:06 chasestruck

Related to #14393

kleinesfilmroellchen avatar Jul 01 '22 11:07 kleinesfilmroellchen

This patch is now definitely in conflict with that Draft PR posted above, given that most of the changes involve a near-complete rework of the path-finding logic.

chasestruck avatar Jul 01 '22 22:07 chasestruck

@chasestruck You can implement this on top of LibManual rather easily, just rebase your changes on #14393 and mark it as draft until that is merged, then you can already make use of LibManual in this PR even before mine is in master. I hope you can figure this out :^)

kleinesfilmroellchen avatar Jul 17 '22 10:07 kleinesfilmroellchen

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Aug 16 '22 23:08 stale[bot]

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!

stale[bot] avatar Aug 31 '22 01:08 stale[bot]