-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepl.cpp
More file actions
29 lines (27 loc) · 832 Bytes
/
repl.cpp
File metadata and controls
29 lines (27 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "repl.hpp"
#include <sbash64/finances/Presenter.hpp>
#include <sbash64/finances/CommandResponder.hpp>
#include <sbash64/finances/FormattedWriter.hpp>
#include <sbash64/finances/ItemizedFormatter.hpp>
#include <sbash64/finances/TransactionRecord.hpp>
#include <gsl/gsl>
#include <iostream>
namespace sbash64::finances {
namespace {
class ConsoleWriter : public Writer {
public:
void write(const std::string &s) override { std::cout << s; }
};
}
[[noreturn]] void repl(Input &input) {
ConsoleWriter writer;
ItemizedFormatter formatter;
FormattedWriter formattedWriter{formatter, writer};
Presenter presenter{formattedWriter};
TransactionRecord record{presenter};
CommandResponder responder{record, formattedWriter};
Prompt prompt{input, responder};
for (;;)
prompt.once();
}
}