ClickHouse/src/Client/ReplxxLineReader.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.5 KiB
C++
Raw Normal View History

2020-01-23 08:18:19 +00:00
#pragma once
2024-06-25 14:23:37 +00:00
#include <Client/LineReader.h>
#include <base/strong_typedef.h>
2020-01-23 08:18:19 +00:00
#include <replxx.hxx>
namespace DB
{
2020-01-23 08:18:19 +00:00
class ReplxxLineReader : public LineReader
{
public:
2024-06-25 14:23:37 +00:00
ReplxxLineReader
(
Suggest & suggest,
2020-06-04 22:45:04 +00:00
const String & history_file_path,
bool multiline,
Patterns extenders_,
Patterns delimiters_,
const char word_break_characters_[],
2024-06-25 14:23:37 +00:00
replxx::Replxx::highlighter_callback_t highlighter_,
std::istream & input_stream_ = std::cin,
std::ostream & output_stream_ = std::cout,
int in_fd_ = STDIN_FILENO,
int out_fd_ = STDOUT_FILENO,
int err_fd_ = STDERR_FILENO
);
2020-01-23 08:18:19 +00:00
~ReplxxLineReader() override;
2020-02-25 08:30:11 +00:00
void enableBracketedPaste() override;
void disableBracketedPaste() override;
2020-02-25 08:30:11 +00:00
2022-01-29 11:44:27 +00:00
/// If highlight is on, we will set a flag to denote whether the last token is a delimiter.
/// This is useful to determine the behavior of <ENTER> key when multiline is enabled.
static void setLastIsDelimiter(bool flag);
2020-01-23 08:18:19 +00:00
private:
InputStatus readOneLine(const String & prompt) override;
void addToHistory(const String & line) override;
int executeEditor(const std::string & path);
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
const char * word_break_characters;
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;
std::string editor;
bool overwrite_mode = false;
2020-01-23 08:18:19 +00:00
};
}