ORE Studio 0.0.4
Loading...
Searching...
No Matches
repl.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_SHELL_APP_REPL_HPP
21#define ORES_SHELL_APP_REPL_HPP
22
23#include <iosfwd>
24#include <memory>
25#include "ores.logging/make_logger.hpp"
26#include "ores.nats/service/nats_client.hpp"
27#include "ores.shell/app/pagination_context.hpp"
28
29namespace cli {
30
31class Cli;
32class CliSession;
33class Menu;
34
35}
36
37namespace ores::shell::app {
38
45class repl final {
46private:
47 inline static std::string_view logger_name =
48 "ores.shell.app.repl";
49
50 static auto& lg() {
51 using namespace ores::logging;
52 static auto instance = make_logger(logger_name);
53 return instance;
54 }
55
56public:
62 explicit repl(ores::nats::service::nats_client& session);
63
64 repl(const repl&) = delete;
65 repl& operator=(const repl&) = delete;
66 repl(repl&&) = delete;
67 repl& operator=(repl&&) = delete;
68
72 void run();
73
80 void run(std::istream& in, std::ostream& out);
81
82private:
86 std::unique_ptr<::cli::Cli> setup_menus();
87
91 void display_welcome(std::ostream& out) const;
92
96 void cleanup();
97
99 pagination_context pagination_;
100 ::cli::CliSession* active_session_{nullptr};
101};
102
103}
104
105#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Application hosting for the interactive shell.
Definition application.hpp:28
Authenticated NATS client for both interactive and service-to-service use.
Definition nats_client.hpp:72
Manages pagination state across shell commands.
Definition pagination_context.hpp:51
Interactive REPL (Read-Eval-Print Loop) for the ORE Studio client.
Definition repl.hpp:45
void run()
Run the REPL session using std::cin and std::cout.
Definition repl.cpp:52