mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#include "DisksApp.h"
|
|
#include "ICommand.h"
|
|
|
|
#include <Interpreters/Context.h>
|
|
#include <Common/TerminalSize.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class CommandHelp final : public ICommand
|
|
{
|
|
public:
|
|
explicit CommandHelp(const DisksApp & disks_app_) : disks_app(disks_app_)
|
|
{
|
|
command_name = "help";
|
|
description = "Print help message about available commands (all or only required)";
|
|
options_description.add_options()("command", po::value<String>(), "A command to help with");
|
|
positional_options_description.add("command", 1);
|
|
}
|
|
|
|
void executeImpl(const CommandLineOptions & options, DisksClient & /*client*/) override
|
|
{
|
|
std::optional<String> command = getValueFromCommandLineOptionsWithOptional<String>(options, "command");
|
|
if (command.has_value())
|
|
{
|
|
disks_app.printCommandHelpMessage(command.value());
|
|
}
|
|
else
|
|
{
|
|
disks_app.printAvailableCommandsHelpMessage();
|
|
}
|
|
}
|
|
|
|
const DisksApp & disks_app;
|
|
};
|
|
|
|
CommandPtr makeCommandHelp(const DisksApp & disks_app)
|
|
{
|
|
return std::make_shared<DB::CommandHelp>(disks_app);
|
|
}
|
|
|
|
}
|