Make C-z ignorance configurable (ignore_shell_suspend) in clickhouse-client

C-z is extermelly useful for some users (like myself), so provide a way
to configure it in client and avoid it's ignorance in clickhouse-disks
(I hope it is OK since it is not that known utility and it does not have
it's own configuration, while cli option is useless, one should remeber
about it).

Honestly I've never seen any interactive client that forbids C-z, so
ignoring it my default looks strange to me.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2024-07-25 16:44:17 +02:00
parent 285f99f719
commit e623ad041f
9 changed files with 12 additions and 5 deletions

View File

@ -53,6 +53,9 @@
</proto_caps>
-->
<!-- Do not send clickhouse-client to background on C-z -->
<!-- <ignore_shell_suspend>true</ignore_shell_suspend> -->
<!--
Settings adjustable via command-line parameters
can take their defaults from that config file, see examples:

View File

@ -247,6 +247,7 @@ void DisksApp::runInteractiveReplxx()
suggest,
history_file,
/* multiline= */ false,
/* ignore_shell_suspend= */ false,
query_extenders,
query_delimiters,
word_break_characters.c_str(),

View File

@ -2,7 +2,7 @@
#include <unordered_map>
#include <vector>
#include <Client/ReplxxLineReader.h>
#include <Client/LineReader.h>
#include <Loggers/Loggers.h>
#include "DisksClient.h"
#include "ICommand_fwd.h"

View File

@ -1,6 +1,5 @@
#include "DisksClient.h"
#include <Client/ClientBase.h>
#include <Client/ReplxxLineReader.h>
#include <Disks/registerDisks.h>
#include <Common/Config/ConfigProcessor.h>

View File

@ -5,9 +5,8 @@
#include <string>
#include <unordered_map>
#include <vector>
#include <Client/ReplxxLineReader.h>
#include <Loggers/Loggers.h>
#include "Disks/IDisk.h"
#include <Disks/IDisk.h>
#include <Interpreters/Context.h>
#include <boost/program_options/options_description.hpp>

View File

@ -314,6 +314,7 @@ void KeeperClient::runInteractiveReplxx()
suggest,
history_file,
/* multiline= */ false,
/* ignore_shell_suspend= */ false,
query_extenders,
query_delimiters,
word_break_characters,

View File

@ -2554,6 +2554,7 @@ void ClientBase::runInteractive()
*suggest,
history_file,
getClientConfiguration().has("multiline"),
getClientConfiguration().getBool("ignore_shell_suspend", true),
query_extenders,
query_delimiters,
word_break_characters,

View File

@ -294,6 +294,7 @@ ReplxxLineReader::ReplxxLineReader(
Suggest & suggest,
const String & history_file_path_,
bool multiline_,
bool ignore_shell_suspend,
Patterns extenders_,
Patterns delimiters_,
const char word_break_characters_[],
@ -363,7 +364,8 @@ ReplxxLineReader::ReplxxLineReader(
rx.bind_key(Replxx::KEY::control('P'), [this](char32_t code) { return rx.invoke(Replxx::ACTION::HISTORY_PREVIOUS, code); });
/// We don't want the default, "suspend" behavior, it confuses people.
rx.bind_key_internal(replxx::Replxx::KEY::control('Z'), "insert_character");
if (ignore_shell_suspend)
rx.bind_key_internal(replxx::Replxx::KEY::control('Z'), "insert_character");
auto commit_action = [this](char32_t code)
{

View File

@ -15,6 +15,7 @@ public:
Suggest & suggest,
const String & history_file_path,
bool multiline,
bool ignore_shell_suspend,
Patterns extenders_,
Patterns delimiters_,
const char word_break_characters_[],