mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Merge pull request #22634 from ClickHouse/client-improve-usability
Improve usability of clickhouse-client
This commit is contained in:
commit
92f57fd669
@ -527,7 +527,10 @@ private:
|
|||||||
std::cerr << std::fixed << std::setprecision(3);
|
std::cerr << std::fixed << std::setprecision(3);
|
||||||
|
|
||||||
if (is_interactive)
|
if (is_interactive)
|
||||||
|
{
|
||||||
|
clearTerminal();
|
||||||
showClientVersion();
|
showClientVersion();
|
||||||
|
}
|
||||||
|
|
||||||
is_default_format = !config().has("vertical") && !config().has("format");
|
is_default_format = !config().has("vertical") && !config().has("format");
|
||||||
if (config().has("vertical"))
|
if (config().has("vertical"))
|
||||||
@ -2467,6 +2470,17 @@ private:
|
|||||||
std::cout << DBMS_NAME << " client version " << VERSION_STRING << VERSION_OFFICIAL << "." << std::endl;
|
std::cout << DBMS_NAME << " client version " << VERSION_STRING << VERSION_OFFICIAL << "." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clearTerminal()
|
||||||
|
{
|
||||||
|
/// Clear from cursor until end of screen.
|
||||||
|
/// It is needed if garbage is left in terminal.
|
||||||
|
/// Show cursor. It can be left hidden by invocation of previous programs.
|
||||||
|
/// A test for this feature: perl -e 'print "x"x100000'; echo -ne '\033[0;0H\033[?25l'; clickhouse-client
|
||||||
|
std::cout <<
|
||||||
|
"\033[0J"
|
||||||
|
"\033[?25h";
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void init(int argc, char ** argv)
|
void init(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user