Skip to content

Commit

Permalink
Merge pull request ClickHouse#48991 from ClickHouse/revert-45819-clic…
Browse files Browse the repository at this point in the history
…khouse-help

Revert "Added tests for ClickHouse apps help and fixed help issues"
  • Loading branch information
alexey-milovidov authored Apr 20, 2023
2 parents 3fc9c31 + 98ae9be commit f6a1752
Show file tree
Hide file tree
Showing 27 changed files with 64 additions and 1,697 deletions.
2 changes: 0 additions & 2 deletions packages/clickhouse-common-static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ contents:
dst: /usr/bin/clickhouse-library-bridge
- src: root/usr/bin/clickhouse-odbc-bridge
dst: /usr/bin/clickhouse-odbc-bridge
- src: root/usr/bin/clickhouse-static-files-disk-uploader
dst: /usr/bin/clickhouse-static-files-disk-uploader
- src: root/usr/share/bash-completion/completions
dst: /usr/share/bash-completion/completions
# docs
Expand Down
2 changes: 0 additions & 2 deletions packages/clickhouse-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ contents:
dst: /usr/bin/clickhouse-report
- src: root/usr/bin/clickhouse-server
dst: /usr/bin/clickhouse-server
- src: root/usr/bin/clickhouse-su
dst: /usr/bin/clickhouse-su
# docs
- src: ../AUTHORS
dst: /usr/share/doc/clickhouse-server/AUTHORS
Expand Down
12 changes: 1 addition & 11 deletions programs/benchmark/Benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,16 +638,6 @@ class Benchmark : public Poco::Util::Application
#pragma GCC optimize("-fno-var-tracking-assignments")
#endif

[[ maybe_unused ]] static std::string getHelpHeader()
{
return
"Usage: clickhouse benchmark [options] < queries.txt\n"
"Usage: clickhouse benchmark [options] --query \"query text\"\n"

"clickhouse-benchmark connects to ClickHouse server,"
" repeatedly sends specified queries and produces reports query statistics.\n";
}

int mainEntryClickHouseBenchmark(int argc, char ** argv)
{
using namespace DB;
Expand Down Expand Up @@ -715,7 +705,7 @@ int mainEntryClickHouseBenchmark(int argc, char ** argv)

if (options.count("help"))
{
std::cout << getHelpHeader();
std::cout << "Usage: " << argv[0] << " [options] < queries.txt\n";
std::cout << desc << "\n";
return 1;
}
Expand Down
35 changes: 0 additions & 35 deletions programs/client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,47 +959,12 @@ bool Client::processWithFuzzing(const String & full_query)
}


[[ maybe_unused ]] static std::string getHelpHeader()
{
return
"Usage: clickhouse client [initial table definition] [--query <query>]\n"
"clickhouse-client is a client application that is used to connect to ClickHouse.\n"

"It can run queries as command line tool if you pass queries as an argument or as interactive client."
" Queries can run one at a time, or in in a multiquery mode with --multiquery option."
" To change settings you may use 'SET' statements and SETTINGS clause in queries or set is for a "
" session with corresponding clickhouse-client arguments.\n"
"'clickhouse client' command will try connect to clickhouse-server running on the same server."
" If you have credentials set up pass them with --user <username> --password <password>"
" or with --ask-password argument that will open command prompt.\n\n"

"This one will try connect to tcp native port(9000) without encryption:\n"
" clickhouse client --host clickhouse.example.com --password mysecretpassword\n"
"To connect to secure endpoint just set --secure argument. If you have "
" artered port set it with --port <your port>.\n"
" clickhouse client --secure --host clickhouse.example.com --password mysecretpassword\n";
}


[[ maybe_unused ]] static std::string getHelpFooter()
{
return
"Note: If you have clickhouse installed on your system you can use 'clickhouse-client'"
" invocation with a dash.\n\n"
"Example printing current longest running query on a server:\n"
" clickhouse client --query 'SELECT * FROM system.processes ORDER BY elapsed LIMIT 1 FORMAT Vertical'\n"
"Example creating table and inserting data:\n";
}


void Client::printHelpMessage(const OptionsDescription & options_description)
{
std::cout << getHelpHeader() << "\n";
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 << "In addition, --param_name=value can be specified for substitution of parameters for parametrized queries.\n";
std::cout << getHelpFooter() << "\n";
}


Expand Down
5 changes: 2 additions & 3 deletions programs/compressor/Compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ int mainEntryClickHouseCompressor(int argc, char ** argv)

if (options.count("help"))
{
std::cout << "Usage: clickhouse compressor [options] < INPUT > OUTPUT" << std::endl;
std::cout << "Alternative usage: clickhouse compressor [options] INPUT OUTPUT" << std::endl;

std::cout << "Usage: " << argv[0] << " [options] < INPUT > OUTPUT" << std::endl;
std::cout << "Usage: " << argv[0] << " [options] INPUT OUTPUT" << std::endl;
std::cout << desc << std::endl;
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions programs/copier/ClusterCopierApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ void ClusterCopierApp::handleHelp(const std::string &, const std::string &)
Poco::Util::HelpFormatter help_formatter(options());
if (terminal_width)
help_formatter.setWidth(terminal_width);
help_formatter.setCommand(commandName() == "clickhouse-copier" ? "clickhouse-copier" : commandName() + " copier");
help_formatter.setCommand(commandName());
help_formatter.setHeader("Copies tables from one cluster to another");
help_formatter.setUsage("--config-file <config-file> --task-path <task-path>");
help_formatter.format(std::cout);
help_formatter.format(std::cerr);

stopOptionsProcessing();
}
Expand Down
3 changes: 2 additions & 1 deletion programs/disks/DisksApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ void DisksApp::printHelpMessage(ProgramOptionsDescription & command_option_descr
help_description->add(command_option_description);

std::cout << "ClickHouse disk management tool\n";
std::cout << "usage clickhouse disks [OPTION]\n" << "clickhouse-disks\n\n";
std::cout << "Usage: ./clickhouse-disks [OPTION]\n";
std::cout << "clickhouse-disks\n\n";

for (const auto & current_command : supported_commands)
std::cout << command_descriptions[current_command]->command_name
Expand Down
6 changes: 3 additions & 3 deletions programs/extract-from-config/ExtractFromConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ int mainEntryClickHouseExtractFromConfig(int argc, char ** argv)

if (options.count("help"))
{
std::cout << "Preprocess config file and extract value of the given key." << std::endl
std::cerr << "Preprocess config file and extract value of the given key." << std::endl
<< std::endl;
std::cout << "Usage: clickhouse extract-from-config [options]" << std::endl
std::cerr << "Usage: clickhouse extract-from-config [options]" << std::endl
<< std::endl;
std::cout << options_desc << std::endl;
std::cerr << options_desc << std::endl;
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion programs/format/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int mainEntryClickHouseFormat(int argc, char ** argv)

if (options.count("help"))
{
std::cout << "Usage: clickhouse format [options] < query" << std::endl;
std::cout << "Usage: " << argv[0] << " [options] < query" << std::endl;
std::cout << desc << std::endl;
return 1;
}
Expand Down
4 changes: 2 additions & 2 deletions programs/git-import/git-import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ try
{
using namespace DB;

po::options_description desc = createOptionsDescription("Allowed options", getTerminalWidth());
po::options_description desc("Allowed options", getTerminalWidth());
desc.add_options()
("help,h", "produce help message")
("skip-commits-without-parents", po::value<bool>()->default_value(true),
Expand Down Expand Up @@ -1218,7 +1218,7 @@ try
if (options.count("help"))
{
std::cout << documentation << '\n'
<< "Usage: clickhouse git-import\n"
<< "Usage: " << argv[0] << '\n'
<< desc << '\n'
<< "\nExample:\n"
<< "\nclickhouse git-import --skip-paths 'generated\\.cpp|^(contrib|docs?|website|libs/(libcityhash|liblz4|libdivide|libvectorclass|libdouble-conversion|libcpuid|libzstd|libfarmhash|libmetrohash|libpoco|libwidechar_width))/' --skip-commits-with-messages '^Merge branch '\n";
Expand Down
Loading

0 comments on commit f6a1752

Please sign in to comment.