Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
repl-interacter.hh
Go to the documentation of this file.
1#pragma once
3
6#include <functional>
7#include <string>
8
9namespace nix {
10
11namespace detail {
15 virtual StringSet completePrefix(const std::string & prefix) = 0;
16};
17};
18
19enum class ReplPromptType {
20 ReplPrompt,
21 ContinuationPrompt,
22};
23
25{
26public:
27 using Guard = Finally<std::function<void()>>;
28
29 virtual Guard init(detail::ReplCompleterMixin * repl) = 0;
31 virtual bool getLine(std::string & input, ReplPromptType promptType) = 0;
32 virtual ~ReplInteracter(){};
33};
34
35class ReadlineLikeInteracter final : public ReplInteracter
36{
37 std::string historyFile;
38public:
39 ReadlineLikeInteracter(std::string historyFile)
40 : historyFile(historyFile)
41 {
42 }
43 virtual Guard init(detail::ReplCompleterMixin * repl) override;
44 virtual bool getLine(std::string & input, ReplPromptType promptType) override;
49 virtual void writeHistory();
50 virtual ~ReadlineLikeInteracter() override;
51};
52
53class AutomationInteracter final : public ReplInteracter
54{
55public:
56 AutomationInteracter() = default;
57 virtual Guard init(detail::ReplCompleterMixin * repl) override;
58 virtual bool getLine(std::string & input, ReplPromptType promptType) override;
59 virtual ~AutomationInteracter() override = default;
60};
61
62};
Definition finally.hh:12
virtual bool getLine(std::string &input, ReplPromptType promptType) override
Definition repl-interacter.cc:264
virtual void writeHistory()
Definition repl-interacter.cc:224
virtual bool getLine(std::string &input, ReplPromptType promptType) override
Definition repl-interacter.cc:179
Definition repl-interacter.hh:25
virtual bool getLine(std::string &input, ReplPromptType promptType)=0
Definition repl-interacter.hh:14