#pragma once #include #include #include #include #include #include #include #include #include namespace DB { namespace po = boost::program_options; using ProgramOptionsDescription = boost::program_options::options_description; using CommandLineOptions = boost::program_options::variables_map; class ICommand { public: ICommand() = default; virtual ~ICommand() = default; void execute( const std::vector & command_arguments, DB::ContextMutablePtr & global_context, Poco::Util::LayeredConfiguration & config); protected: virtual void processOptions( Poco::Util::LayeredConfiguration & config, po::variables_map & options) const = 0; virtual void executeImpl( const DB::ContextMutablePtr & global_context, const Poco::Util::LayeredConfiguration & config) const = 0; void printHelpMessage() const; static String fullPathWithValidate(const DiskPtr & disk, const String & path); public: String command_name; String description; protected: std::optional command_option_description; String usage; po::positional_options_description positional_options_description; std::vector pos_arguments; }; } std::unique_ptr makeCommandCopy(); std::unique_ptr makeCommandLink(); std::unique_ptr makeCommandList(); std::unique_ptr makeCommandListDisks(); std::unique_ptr makeCommandMove(); std::unique_ptr makeCommandRead(); std::unique_ptr makeCommandRemove(); std::unique_ptr makeCommandWrite();