ClickHouse/programs/disks/CommandGetCurrentDiskAndPath.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
814 B
C++
Raw Normal View History

2024-06-13 19:14:16 +00:00
#include <Interpreters/Context.h>
#include <Common/TerminalSize.h>
#include "DisksApp.h"
#include "DisksClient.h"
#include "ICommand.h"
namespace DB
{
class CommandGetCurrentDiskAndPath final : public ICommand
{
public:
explicit CommandGetCurrentDiskAndPath() : ICommand()
{
command_name = "current_disk_with_path";
2024-07-04 14:09:43 +00:00
description = "Prints current disk and path (which coincide with the prompt)";
2024-06-13 19:14:16 +00:00
}
void executeImpl(const CommandLineOptions &, DisksClient & client) override
{
2024-10-15 16:24:06 +00:00
const auto & disk = client.getCurrentDiskWithPath();
2024-06-13 19:14:16 +00:00
std::cout << "Disk: " << disk.getDisk()->getName() << "\nPath: " << disk.getCurrentPath() << std::endl;
}
};
CommandPtr makeCommandGetCurrentDiskAndPath()
{
return std::make_shared<DB::CommandGetCurrentDiskAndPath>();
}
}