mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Use terminal width for the formatted help text of the clickhouse-copier
Like other utils, clickhouse-client and so on (since copier uses Poco, while other uses boost). Otherwise clickhouse-copier --help is unreadable.
This commit is contained in:
parent
0b07121177
commit
0a34ae85a3
@ -1,5 +1,7 @@
|
||||
#include "ClusterCopierApp.h"
|
||||
#include <Common/StatusFile.h>
|
||||
#include <Common/TerminalSize.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -52,7 +54,13 @@ void ClusterCopierApp::initialize(Poco::Util::Application & self)
|
||||
|
||||
void ClusterCopierApp::handleHelp(const std::string &, const std::string &)
|
||||
{
|
||||
uint16_t terminal_width = 0;
|
||||
if (isatty(STDIN_FILENO))
|
||||
terminal_width = getTerminalWidth();
|
||||
|
||||
Poco::Util::HelpFormatter help_formatter(options());
|
||||
if (terminal_width)
|
||||
help_formatter.setWidth(terminal_width);
|
||||
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>");
|
||||
|
Loading…
Reference in New Issue
Block a user