Help+man+LibManual: Refactor the help system to support nested sections in the future
This is just the refactoring that needs to happen before nested sections, a feature recently requested that I'm very much on board with. The main advantages right now is unified improved help/man argument handling.
@kleinesfilmroellchen
GitHub doesn't let me review unchanged code, so I'm doing this in a normal comment.
In Userland/Utilities/man.cpp, line 97 is left unchanged:
out("{}({})", name, section);
This causes the name(section) part of the manpage title to be incorrect when the user does not explictly supply name and section.
For instance, if I run $ man getuid, this part of the title evaluates to (getuid) instead of getuid(2).
If I supply a full path, e.g., $ man /usr/share/man/man2/getuid.md, it evaluates to (/usr/share/man/man2/getuid.md).
Only if I supply both arguments, i.e., $ man 2 getuid, does it correctly evaluate to getuid(2).
Perhaps just use the member variables of page here instead?
@chasestruck absolutely, that's old code from before LibManual
@chasestruck should be fixed now
Looks like this one accumulated some conflicts from Tim's PR re-organizing linked libs
I'm still confused by the line in man.cpp page = Manual::PageNode { Manual::sections[number_section.value() - 1], name }; which assigns RefCounted object to an Optional<NonnullRefPtr<Manual::PageNode>> without allocating it on the heap -- just referring to a value that we move into place. That should not be allowed.
After that's fixed and the target_link_libraries lines are properly rebased (all libs are PRIVATE for now) this should be good to marge
Why is any of this even linking against that library...
This has conflicts.