mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
This commit improves the help output for all ClickHouse applications: - Add `clickhouse help` command that lists all available subcommands - Return exit code 0 for all help messages (previously some returned 1) - Output help messages to stdout instead of stderr - Use "clickhouse <cmd>" format instead of argv[0] in help messages - Add dynamic `app_name` detection for `clickhouse client` and `clickhouse local` to show correct invocation name based on how the binary was called - Add `--no-sudo` option for `clickhouse start` and `clickhouse restart` for environments without sudo (e.g., Docker containers) - Add detailed help headers and footers for client and local with usage examples Closes #58244 Co-Authored-By: Claude Opus 4.5 <[email protected]>
87 lines
2.3 KiB
C++
87 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <Client/ClientApplicationBase.h>
|
|
|
|
|
|
namespace BuzzHouse
|
|
{
|
|
class FuzzConfig;
|
|
class ExternalIntegrations;
|
|
};
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class Client : public ClientApplicationBase
|
|
{
|
|
public:
|
|
using Arguments = ClientApplicationBase::Arguments;
|
|
|
|
Client();
|
|
~Client() override;
|
|
|
|
void initialize(Poco::Util::Application & self) override;
|
|
|
|
int main(const std::vector<String> & /*args*/) override;
|
|
|
|
bool tryToReconnect(uint32_t max_reconnection_attempts, uint32_t time_to_sleep_between) override;
|
|
protected:
|
|
Poco::Util::LayeredConfiguration & getClientConfiguration() override;
|
|
|
|
bool processWithASTFuzzer(std::string_view full_query) override;
|
|
bool buzzHouse() override;
|
|
bool processASTFuzzerStep(const String & query_to_execute, const ASTPtr & parsed_query);
|
|
|
|
#if USE_JWT_CPP && USE_SSL
|
|
void login();
|
|
#endif
|
|
|
|
void connect() override;
|
|
|
|
void processError(std::string_view query) const override;
|
|
|
|
String getName() const override { return "client"; }
|
|
|
|
void printHelpMessage(const OptionsDescription & options_description) override;
|
|
|
|
void addExtraOptions(OptionsDescription & options_description) override;
|
|
|
|
void processOptions(
|
|
const OptionsDescription & options_description,
|
|
const CommandLineOptions & options,
|
|
const std::vector<Arguments> & external_tables_arguments,
|
|
const std::vector<Arguments> & hosts_and_ports_arguments) override;
|
|
|
|
void processConfig() override;
|
|
|
|
void readArguments(
|
|
int argc,
|
|
char ** argv,
|
|
Arguments & common_arguments,
|
|
std::vector<Arguments> & external_tables_arguments,
|
|
std::vector<Arguments> & hosts_and_ports_arguments) override;
|
|
|
|
private:
|
|
String getHelpHeader() const;
|
|
String getHelpFooter() const;
|
|
void printChangedSettings() const;
|
|
void showWarnings();
|
|
#if USE_BUZZHOUSE
|
|
std::unique_ptr<BuzzHouse::FuzzConfig> fuzz_config;
|
|
std::unique_ptr<BuzzHouse::ExternalIntegrations> external_integrations;
|
|
|
|
bool logAndProcessQuery(std::ofstream & outf, const String & full_query);
|
|
bool processBuzzHouseQuery(const String & full_query);
|
|
bool fuzzLoopReconnect();
|
|
#endif
|
|
std::vector<String> loadWarningMessages();
|
|
|
|
CurrentThread::QueryScope query_scope;
|
|
|
|
#if USE_JWT_CPP && USE_SSL
|
|
std::shared_ptr<JWTProvider> jwt_provider;
|
|
bool login_was_auto_added = false;
|
|
#endif
|
|
};
|
|
}
|