mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
add --verbose for help and suggest to use system.settings
This commit is contained in:
parent
0cc404a74c
commit
a36d86f63a
@ -598,6 +598,7 @@ int mainEntryClickHouseBenchmark(int argc, char ** argv)
|
||||
boost::program_options::options_description desc = createOptionsDescription("Allowed options", getTerminalWidth());
|
||||
desc.add_options()
|
||||
("help", "produce help message")
|
||||
("verbose", "print more detailed message")
|
||||
("query,q", value<std::string>()->default_value(""), "query to execute")
|
||||
("concurrency,c", value<unsigned>()->default_value(1), "number of parallel queries")
|
||||
("delay,d", value<double>()->default_value(1), "delay between intermediate reports in seconds (set 0 to disable reports)")
|
||||
@ -629,13 +630,19 @@ int mainEntryClickHouseBenchmark(int argc, char ** argv)
|
||||
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), options);
|
||||
boost::program_options::notify(options);
|
||||
|
||||
if (options.count("verbose"))
|
||||
settings.addProgramOptions(desc);
|
||||
|
||||
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), options);
|
||||
boost::program_options::notify(options);
|
||||
|
||||
clearPasswordFromCommandLine(argc, argv);
|
||||
|
||||
if (options.count("help"))
|
||||
{
|
||||
std::cout << "Usage: " << argv[0] << " [options] < queries.txt\n";
|
||||
std::cout << desc << "\n";
|
||||
std::cout << "All setting parameters are documented in detail at https://clickhouse.com/docs/\n";
|
||||
std::cout << "All setting parameters are documented in detail at https://clickhouse.com/docs/ or you can access them in `system.settings` table.\n";
|
||||
std::cout << "\nSee also: https://clickhouse.com/docs/en/operations/utilities/clickhouse-benchmark/\n";
|
||||
return 0;
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ void Client::printHelpMessage(const OptionsDescription & options_description)
|
||||
std::cout << options_description.main_description.value() << "\n";
|
||||
std::cout << options_description.external_description.value() << "\n";
|
||||
std::cout << options_description.hosts_and_ports_description.value() << "\n";
|
||||
std::cout << "All setting parameters are documented in detail at https://clickhouse.com/docs/\n\n";
|
||||
std::cout << "All setting parameters are documented in detail at https://clickhouse.com/docs/ or you can access them in `system.settings` table.\n\n";
|
||||
std::cout << "In addition, --param_name=value can be specified for substitution of parameters for parametrized queries.\n";
|
||||
std::cout << "\nSee also: https://clickhouse.com/docs/en/integrations/sql-clients/cli\n";
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ void LocalServer::printHelpMessage([[maybe_unused]] const OptionsDescription & o
|
||||
{
|
||||
std::cout << getHelpHeader() << "\n";
|
||||
std::cout << options_description.main_description.value() << "\n";
|
||||
std::cout << "All setting parameters are documented in detail at https://clickhouse.com/docs/\n\n";
|
||||
std::cout << "All setting parameters are documented in detail at https://clickhouse.com/docs/ or you can access them in `system.settings` table.\n\n";
|
||||
std::cout << getHelpFooter() << "\n";
|
||||
std::cout << "In addition, --param_name=value can be specified for substitution of parameters for parametrized queries.\n";
|
||||
std::cout << "\nSee also: https://clickhouse.com/docs/en/operations/utilities/clickhouse-local/\n";
|
||||
|
@ -2844,6 +2844,31 @@ private:
|
||||
}
|
||||
|
||||
|
||||
void ClientBase::verboseHelpMessageIfNeeded(OptionsDescription & options_description)
|
||||
{
|
||||
if (config().getBool("verbose", false))
|
||||
{
|
||||
auto getter = [](const auto & op)
|
||||
{
|
||||
String op_long_name = op->long_name();
|
||||
return "--" + String(op_long_name);
|
||||
};
|
||||
|
||||
if (options_description.main_description)
|
||||
{
|
||||
const auto & main_options = options_description.main_description->options();
|
||||
std::transform(main_options.begin(), main_options.end(), std::back_inserter(cmd_options), getter);
|
||||
}
|
||||
|
||||
if (options_description.external_description)
|
||||
{
|
||||
const auto & external_options = options_description.external_description->options();
|
||||
std::transform(external_options.begin(), external_options.end(), std::back_inserter(cmd_options), getter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ClientBase::parseAndCheckOptions(OptionsDescription & options_description, po::variables_map & options, Arguments & arguments)
|
||||
{
|
||||
if (allow_merge_tree_settings)
|
||||
|
@ -174,6 +174,7 @@ private:
|
||||
String prompt() const;
|
||||
|
||||
void resetOutput();
|
||||
void verboseHelpMessageIfNeeded(OptionsDescription & options_description);
|
||||
void parseAndCheckOptions(OptionsDescription & options_description, po::variables_map & options, Arguments & arguments);
|
||||
|
||||
void updateSuggest(const ASTPtr & ast);
|
||||
|
Loading…
Reference in New Issue
Block a user