Skip to content

Commit c09d0c4

Browse files
tcl3ADKaster
authored andcommitted
LibManual: Allow querying on a help URL
This allows Help and man to open pages from a help URL specified on the command line.
1 parent 6ab1348 commit c09d0c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Userland/Libraries/LibManual/Node.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ ErrorOr<NonnullRefPtr<PageNode const>> Node::try_create_from_query(Vector<String
2222
if (query_parameters.size() > 2)
2323
return Error::from_string_literal("Queries longer than 2 strings are not supported yet");
2424

25+
if (query_parameters.size() == 1 && query_parameters[0].starts_with("help://"sv)) {
26+
auto help_url = URL::create_with_url_or_path(query_parameters[0].trim("/"sv, TrimMode::Right));
27+
auto node_from_url = TRY(Manual::Node::try_find_from_help_url(help_url));
28+
return *node_from_url->document();
29+
}
30+
2531
auto query_parameter_iterator = query_parameters.begin();
2632

2733
if (query_parameter_iterator.is_end())

0 commit comments

Comments
 (0)