ClickHouse/base/common/ReplxxLineReader.h

35 lines
868 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;
2020-12-01 12:48:35 +00:00
int execute(const std::string & command);
2020-12-01 10:34:34 +00:00
void openEditor();
2020-01-23 08:18:19 +00:00
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-12-01 10:34:34 +00:00
bool bracketed_paste_enabled = false;
2020-01-23 08:18:19 +00:00
};