From 0a34ae85a33a8e490acca365bddf5db5146dc1c5 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 25 Aug 2020 21:15:36 +0300 Subject: [PATCH] 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. --- programs/copier/ClusterCopierApp.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/programs/copier/ClusterCopierApp.cpp b/programs/copier/ClusterCopierApp.cpp index d6ec5a7e8ad..ec64e118f45 100644 --- a/programs/copier/ClusterCopierApp.cpp +++ b/programs/copier/ClusterCopierApp.cpp @@ -1,5 +1,7 @@ #include "ClusterCopierApp.h" #include +#include +#include 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 --task-path ");