From bbda83f674a97e80cf89bff3d12737dd5ecc3243 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 7 Sep 2023 15:41:09 +0200 Subject: wandac: extract cli and commander listener --- source/app/wandac/include/wandac/cli.hpp | 27 +++++++++++++++++++++++++++ source/app/wandac/include/wandac/listener.hpp | 26 ++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 source/app/wandac/include/wandac/cli.hpp create mode 100644 source/app/wandac/include/wandac/listener.hpp (limited to 'source/app/wandac/include') diff --git a/source/app/wandac/include/wandac/cli.hpp b/source/app/wandac/include/wandac/cli.hpp new file mode 100644 index 0000000..c04b138 --- /dev/null +++ b/source/app/wandac/include/wandac/cli.hpp @@ -0,0 +1,27 @@ +#ifndef WANDA_APP_WANDAC_CLI_HPP +#define WANDA_APP_WANDAC_CLI_HPP + +#include +#include + +#include +#include + +namespace wandac +{ + + struct cli + { + auto parse(lyra::args arguments, std::ostream & error_stream) -> bool; + auto print_usage(std::ostream & output_stream) -> void; + + std::string command{}; + bool help{}; + + private: + lyra::cli_parser parser{}; + }; + +} // namespace wandac + +#endif \ No newline at end of file diff --git a/source/app/wandac/include/wandac/listener.hpp b/source/app/wandac/include/wandac/listener.hpp new file mode 100644 index 0000000..49b75b6 --- /dev/null +++ b/source/app/wandac/include/wandac/listener.hpp @@ -0,0 +1,26 @@ +#ifndef WANDA_APP_WANDAC_LISTENER_HPP +#define WANDA_APP_WANDAC_LISTENER_HPP + +#include "wandac/cli.hpp" + +#include + +#include + +namespace wandac +{ + + struct listener : wanda::control::commander::listener + { + listener(wandac::cli const & cli, boost::asio::io_context & service); + + auto on_connected(wanda::control::commander & commander) -> void override ; + + private: + wandac::cli const & m_cli; + boost::asio::io_context & m_service; + }; + +} // namespace wandac + +#endif \ No newline at end of file -- cgit v1.2.3