mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Inspector: Add help documentation
This commit is contained in:
parent
82278d632f
commit
501834ba45
Notes:
sideshowbarker
2024-07-18 22:00:13 +09:00
Author: https://github.com/bcoles Commit: https://github.com/SerenityOS/serenity/commit/501834ba454 Pull-request: https://github.com/SerenityOS/serenity/pull/5485
3 changed files with 39 additions and 1 deletions
25
Base/usr/share/man/man1/Inspector.md
Normal file
25
Base/usr/share/man/man1/Inspector.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
## Name
|
||||
|
||||
Inspector - Serenity process inspector
|
||||
|
||||
## Synopsis
|
||||
|
||||
```**sh
|
||||
$ Inspector [pid]
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
Inspector facilitates process inspection via RPC.
|
||||
|
||||
The inspected process must have previously allowed the
|
||||
[`accept`(2)](../man2/accept.md) system call with
|
||||
[`pledge`(2)](../man2/pledge.md) to allow inspection
|
||||
via UNIX socket.
|
||||
|
||||
## Examples
|
||||
|
||||
```sh
|
||||
$ Inspector $(pidof Shell)
|
||||
```
|
||||
|
|
@ -7,4 +7,4 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_app(Inspector ICON app-inspector)
|
||||
target_link_libraries(Inspector LibGUI)
|
||||
target_link_libraries(Inspector LibDesktop LibGUI)
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
#include "RemoteObjectGraphModel.h"
|
||||
#include "RemoteObjectPropertyModel.h"
|
||||
#include "RemoteProcess.h"
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/ProcessStatisticsReader.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
|
@ -101,6 +103,14 @@ int main(int argc, char** argv)
|
|||
|
||||
auto window = GUI::Window::construct();
|
||||
|
||||
if (!Desktop::Launcher::add_allowed_handler_with_only_specific_urls(
|
||||
"/bin/Help",
|
||||
{ URL::create_with_file_protocol("/usr/share/man/man1/Inspector.md") })
|
||||
|| !Desktop::Launcher::seal_allowlist()) {
|
||||
warnln("Failed to set up allowed launch URLs");
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto all_processes = Core::ProcessStatisticsReader::get_all();
|
||||
for (auto& it : all_processes.value()) {
|
||||
if (it.value.pid != pid)
|
||||
|
@ -123,6 +133,9 @@ int main(int argc, char** argv)
|
|||
app_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); }));
|
||||
|
||||
auto& help_menu = menubar->add_menu("Help");
|
||||
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/Inspector.md"), "/bin/Help");
|
||||
}));
|
||||
help_menu.add_action(GUI::CommonActions::make_about_action("Inspector", app_icon, window));
|
||||
|
||||
auto& widget = window->set_main_widget<GUI::Widget>();
|
||||
|
|
Loading…
Reference in a new issue