Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
repl-interacter.hh
Go to the documentation of this file.
1#pragma once
3
4#include "finally.hh"
5#include "types.hh"
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 : public virtual 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;
45 virtual ~ReadlineLikeInteracter() override;
46};
47
48};
Definition finally.hh:13
virtual bool getLine(std::string &input, ReplPromptType promptType) override
Definition repl-interacter.cc:141
Definition repl-interacter.hh:25
virtual bool getLine(std::string &input, ReplPromptType promptType)=0
Definition repl-interacter.hh:14