|
YODAU 1.0
YEAR OF THE DEPEND ADULT UNDERGARMENT
|
Simple interactive CLI (REPL) for controlling a stream_manager. More...
#include <backend/include/cli_client.hpp>

Public Member Functions | |
| cli_client (backend::stream_manager &mgr) | |
| Construct a CLI client operating on an existing manager. | |
| int | run () const |
| Run the interactive command loop. | |
Private Member Functions | |
| void | dispatch_command (const std::string &cmd, const std::vector< std::string > &args) const |
| Dispatch a command to its handler. | |
| void | cmd_list_streams (const std::vector< std::string > &args) const |
| Handler for list-streams. | |
| void | cmd_add_stream (const std::vector< std::string > &args) const |
| Handler for add-stream. | |
| void | cmd_start_stream (const std::vector< std::string > &args) const |
| Handler for start-stream. | |
| void | cmd_stop_stream (const std::vector< std::string > &args) const |
| Handler for stop-stream. | |
| void | cmd_list_lines (const std::vector< std::string > &args) const |
| Handler for list-lines. | |
| void | cmd_add_line (const std::vector< std::string > &args) const |
| Handler for add-line. | |
| void | cmd_set_line (const std::vector< std::string > &args) const |
| Handler for set-line. | |
Static Private Member Functions | |
| static std::vector< std::string > | tokenize (const std::string &line) |
| Split a line into whitespace-separated tokens. | |
| static cxxopts::ParseResult | parse_with_cxxopts (const std::string &cmd, const std::vector< std::string > &args, cxxopts::Options &options) |
| Parse command arguments using cxxopts. | |
Private Attributes | |
| backend::stream_manager & | stream_mgr |
| Stream manager controlled by this CLI. | |
Simple interactive CLI (REPL) for controlling a stream_manager.
The cli_client provides a text-based command loop that allows the user to:
The client does not own the manager; it holds a reference and issues synchronous calls to it.
Definition at line 28 of file cli_client.hpp.
|
explicit |
Construct a CLI client operating on an existing manager.
The manager reference must remain valid for the lifetime of this client.
| mgr | Stream manager to control. |
Definition at line 5 of file cli_client.cpp.
References stream_mgr.
Referenced by main().

|
private |
Handler for add-line.
Positional arguments:
Options:
| args | Tokenized arguments. |
Definition at line 244 of file cli_client.cpp.
References parse_tripwire_dir(), and stream_mgr.

|
private |
Handler for add-stream.
Positional arguments:
| args | Tokenized arguments. |
Definition at line 113 of file cli_client.cpp.
References stream_mgr.
|
private |
Handler for list-lines.
Lists all stored lines in the manager.
| args | Tokenized arguments. |
Definition at line 209 of file cli_client.cpp.
References stream_mgr.
|
private |
Handler for list-streams.
Supports optional --connections to show connected line names.
| args | Tokenized arguments. |
Definition at line 87 of file cli_client.cpp.
References stream_mgr.
|
private |
Handler for set-line.
Positional arguments:
Connects an existing line to an existing stream.
| args | Tokenized arguments. |
Definition at line 293 of file cli_client.cpp.
References stream_mgr.
|
private |
Handler for start-stream.
Positional argument:
| args | Tokenized arguments. |
Definition at line 151 of file cli_client.cpp.
References stream_mgr.
|
private |
Handler for stop-stream.
Positional argument:
| args | Tokenized arguments. |
Definition at line 180 of file cli_client.cpp.
References stream_mgr.
|
private |
Dispatch a command to its handler.
Looks up cmd in the internal command map and invokes the corresponding cmd_* method. Unknown commands print an error to stderr.
| cmd | Command name (e.g., "add-stream"). |
| args | Tokenized arguments excluding the command name. |
Definition at line 45 of file cli_client.cpp.
|
staticprivate |
Parse command arguments using cxxopts.
Builds a temporary argv-like array from cmd and args and calls cxxopts::Options::parse.
| cmd | Command name (used as argv[0]). |
| args | Command arguments. |
| options | Configured cxxopts options for this command. |
Definition at line 72 of file cli_client.cpp.
| int yodau::backend::cli_client::run | ( | ) | const |
Run the interactive command loop.
This function reads commands from stdin and prints results/errors to stdout/stderr until the user enters one of the quit commands: "quit", "q", or "exit".
Definition at line 13 of file cli_client.cpp.
Referenced by main().

|
staticprivate |
Split a line into whitespace-separated tokens.
Used to parse the REPL input into:
| line | Raw input line. |
Definition at line 35 of file cli_client.cpp.
|
private |
Stream manager controlled by this CLI.
Non-owning reference.
Definition at line 176 of file cli_client.hpp.
Referenced by cli_client(), cmd_add_line(), cmd_add_stream(), cmd_list_lines(), cmd_list_streams(), cmd_set_line(), cmd_start_stream(), and cmd_stop_stream().