mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 13:35:09 +00:00
LibManual: Allow querying on a help URL
This allows Help and man to open pages from a help URL specified on the command line.
This commit is contained in:
parent
6ab13489ee
commit
c09d0c4816
1 changed files with 6 additions and 0 deletions
|
@ -22,6 +22,12 @@ ErrorOr<NonnullRefPtr<PageNode const>> Node::try_create_from_query(Vector<String
|
|||
if (query_parameters.size() > 2)
|
||||
return Error::from_string_literal("Queries longer than 2 strings are not supported yet");
|
||||
|
||||
if (query_parameters.size() == 1 && query_parameters[0].starts_with("help://"sv)) {
|
||||
auto help_url = URL::create_with_url_or_path(query_parameters[0].trim("/"sv, TrimMode::Right));
|
||||
auto node_from_url = TRY(Manual::Node::try_find_from_help_url(help_url));
|
||||
return *node_from_url->document();
|
||||
}
|
||||
|
||||
auto query_parameter_iterator = query_parameters.begin();
|
||||
|
||||
if (query_parameter_iterator.is_end())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue