2022-04-08 07:52:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ICommand.h"
|
2022-07-20 20:30:16 +00:00
|
|
|
#include <Interpreters/Context.h>
|
2022-04-08 07:52:16 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int BAD_ARGUMENTS;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CommandListDisks : public ICommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CommandListDisks()
|
|
|
|
{
|
|
|
|
command_name = "list-disks";
|
|
|
|
description = "List disks names";
|
2022-06-16 17:38:33 +00:00
|
|
|
usage = "list-disks [OPTION]";
|
2022-04-08 07:52:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void processOptions(
|
2022-06-06 11:14:50 +00:00
|
|
|
Poco::Util::LayeredConfiguration &,
|
2022-06-16 17:38:33 +00:00
|
|
|
po::variables_map &) const override
|
|
|
|
{}
|
2022-04-08 07:52:16 +00:00
|
|
|
|
2022-06-16 17:38:33 +00:00
|
|
|
void execute(
|
|
|
|
const std::vector<String> & command_arguments,
|
|
|
|
DB::ContextMutablePtr & global_context,
|
|
|
|
Poco::Util::LayeredConfiguration &) override
|
2022-04-08 07:52:16 +00:00
|
|
|
{
|
2022-06-16 17:38:33 +00:00
|
|
|
if (!command_arguments.empty())
|
2022-04-08 07:52:16 +00:00
|
|
|
{
|
|
|
|
printHelpMessage();
|
|
|
|
throw DB::Exception("Bad Arguments", DB::ErrorCodes::BAD_ARGUMENTS);
|
|
|
|
}
|
|
|
|
|
2022-06-03 05:21:45 +00:00
|
|
|
for (const auto & [disk_name, _] : global_context->getDisksMap())
|
2022-04-08 07:52:16 +00:00
|
|
|
std::cout << disk_name << '\n';
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr <DB::ICommand> makeCommandListDisks()
|
|
|
|
{
|
|
|
|
return std::make_unique<DB::CommandListDisks>();
|
|
|
|
}
|