mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Add clickhouse-client option: --version
This commit is contained in:
parent
f9c31c42c5
commit
b22e4981df
@ -304,10 +304,7 @@ private:
|
||||
std::cerr << std::fixed << std::setprecision(3);
|
||||
|
||||
if (is_interactive)
|
||||
std::cout << "ClickHouse client version " << DBMS_VERSION_MAJOR
|
||||
<< "." << DBMS_VERSION_MINOR
|
||||
<< "." << ClickHouseRevision::get()
|
||||
<< "." << std::endl;
|
||||
showClientVersion();
|
||||
|
||||
if (config().has("vertical"))
|
||||
format = config().getString("format", "Vertical");
|
||||
@ -1157,6 +1154,14 @@ private:
|
||||
std::cout << "Ok." << std::endl;
|
||||
}
|
||||
|
||||
void showClientVersion()
|
||||
{
|
||||
std::cout << "ClickHouse client version " << DBMS_VERSION_MAJOR
|
||||
<< "." << DBMS_VERSION_MINOR
|
||||
<< "." << ClickHouseRevision::get()
|
||||
<< "." << std::endl;
|
||||
}
|
||||
|
||||
public:
|
||||
void init(int argc, char ** argv)
|
||||
{
|
||||
@ -1222,6 +1227,7 @@ public:
|
||||
("time,t", "print query execution time to stderr in non-interactive mode (for benchmarks)")
|
||||
("stacktrace", "print stack traces of exceptions")
|
||||
("progress", "print progress even in non-interactive mode")
|
||||
("version,V", "print version information and exit")
|
||||
("echo", "in batch mode, print query before execution")
|
||||
("compression", boost::program_options::value<bool>(), "enable or disable compression")
|
||||
APPLY_FOR_SETTINGS(DECLARE_SETTING)
|
||||
@ -1246,6 +1252,12 @@ public:
|
||||
boost::program_options::variables_map options;
|
||||
boost::program_options::store(parsed, options);
|
||||
|
||||
if (options.count("version") || options.count("V"))
|
||||
{
|
||||
showClientVersion();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/// Output of help message.
|
||||
if (options.count("help")
|
||||
|| (options.count("host") && options["host"].as<std::string>() == "elp")) /// If user writes -help instead of --help.
|
||||
|
Loading…
Reference in New Issue
Block a user