serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Help+man+LibManual: Refactor the help system to support nested sections in the future

Open kleinesfilmroellchen opened this issue 3 years ago • 3 comments

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 avatar Jun 26 '22 15:06 kleinesfilmroellchen

@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 avatar Jul 28 '22 22:07 chasestruck

@chasestruck absolutely, that's old code from before LibManual

kleinesfilmroellchen avatar Aug 04 '22 21:08 kleinesfilmroellchen

@chasestruck should be fixed now

kleinesfilmroellchen avatar Aug 16 '22 09:08 kleinesfilmroellchen

Looks like this one accumulated some conflicts from Tim's PR re-organizing linked libs

ADKaster avatar Nov 04 '22 06:11 ADKaster

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

ADKaster avatar Nov 04 '22 06:11 ADKaster

Why is any of this even linking against that library...

kleinesfilmroellchen avatar Nov 26 '22 18:11 kleinesfilmroellchen

This has conflicts.

AtkinsSJ avatar Dec 06 '22 15:12 AtkinsSJ