ClickHouse/base/common/ReplxxLineReader.h

32 lines
757 B
C++
Raw Normal View History

2020-01-23 08:18:19 +00:00
#pragma once
#include "LineReader.h"
#include <replxx.hxx>
2020-06-04 22:45:04 +00:00
2020-01-23 08:18:19 +00:00
class ReplxxLineReader : public LineReader
{
public:
2020-06-04 22:45:04 +00:00
ReplxxLineReader(
const Suggest & suggest,
const String & history_file_path,
bool multiline,
Patterns extenders_,
Patterns delimiters_,
replxx::Replxx::highlighter_callback_t highlighter_);
2020-01-23 08:18:19 +00:00
~ReplxxLineReader() override;
2020-02-25 08:30:11 +00:00
void enableBracketedPaste() override;
2020-01-23 08:18:19 +00:00
private:
InputStatus readOneLine(const String & prompt) override;
void addToHistory(const String & line) override;
replxx::Replxx rx;
2020-06-04 22:45:04 +00:00
replxx::Replxx::highlighter_callback_t highlighter;
2020-06-04 21:31:51 +00:00
// used to call flock() to synchronize multiple clients using same history file
int history_file_fd = -1;
2020-01-23 08:18:19 +00:00
};