Utilities: Fix title formatting in man

`String::repeated()` returns a `ErrorOr<String>`, so wrap it in `TRY()`.

This fixes a glitch in the title formatting (`{}` not removed if
`ErrorOr<String>` is directly passed to `outln()`).
This commit is contained in:
ronak69 2023-08-04 06:23:24 +00:00 committed by Daniel Bertalan
parent 720d9dd683
commit 0787241cdc
Notes: sideshowbarker 2024-07-17 06:54:15 +09:00

View file

@ -98,7 +98,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto const title = "SerenityOS manual"_string;
int spaces = max(view_width / 2 - page_name.code_points().length() - section_number.code_points().length() - title.code_points().length() / 2 - 4, 0);
outln("{}({}){}{}", page_name, section_number, String::repeated(' ', spaces), title);
outln("{}({}){}{}", page_name, section_number, TRY(String::repeated(' ', spaces)), title);
auto document = Markdown::Document::parse(buffer);
VERIFY(document);