serenity
serenity copied to clipboard
man: Implement dynamic manpage titles
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
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
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.
Only thing is that if we do want that, wouldn't it be awkward to have
man(1)depend onhelp(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.
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.
Related to #14393
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 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 :^)
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!
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!