mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 22:47:45 +00:00
Help+man+LibManual: Move argument handling to LibManual
This deduplicates argument handling logic from Help and man and makes it more modular for future use cases. The argument handling works as before: two arguments specify section and page (in this order), one argument specifies either a page (the first section that it's found in is used) or a path to a manpage markdown file.
This commit is contained in:
parent
64ca546a06
commit
b65258c093
9 changed files with 149 additions and 125 deletions
|
@ -25,6 +25,13 @@ public:
|
|||
virtual ErrorOr<String> name() const = 0;
|
||||
virtual bool is_page() const { return false; }
|
||||
virtual bool is_open() const { return false; }
|
||||
|
||||
// Backend for the command-line argument format that Help and man accept. Handles:
|
||||
// [/path/to/documentation.md] (no second argument)
|
||||
// [page] (no second argument) - will find first section with that page
|
||||
// [section] [page]
|
||||
// Help can also (externally) handle search queries, which is not possible (yet) in man.
|
||||
static ErrorOr<NonnullRefPtr<PageNode>> try_create_from_query(Vector<StringView, 2> const& query_parameters);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue