diff options
author | Tim Ledbetter <timledbetter@gmail.com> | 2023-04-25 17:34:19 +0100 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2023-05-08 21:03:19 -0600 |
commit | c09d0c4816e68c436a2a3d75042b8478d40d8f1c (patch) | |
tree | a74c2ddd6ed32253bae031bc8112ac23deebbf18 | |
parent | 6ab13489eed93f75643caa9c986ef44078a46f48 (diff) | |
download | serenity-c09d0c4816e68c436a2a3d75042b8478d40d8f1c.zip |
LibManual: Allow querying on a help URL
This allows Help and man to open pages from a help URL specified on
the command line.
-rw-r--r-- | Userland/Libraries/LibManual/Node.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibManual/Node.cpp b/Userland/Libraries/LibManual/Node.cpp index dc6871d07f..30b4384de8 100644 --- a/Userland/Libraries/LibManual/Node.cpp +++ b/Userland/Libraries/LibManual/Node.cpp @@ -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()) |