Merge pull request #14057 from azat/clickhouse-copier-cmd-args-width

Use terminal width for the formatted help text of the clickhouse-copier
This commit is contained in:
alexey-milovidov 2020-08-26 02:27:12 +03:00 committed by GitHub
commit 2c45c27e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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>");