Add highlighting

This commit is contained in:
divanik 2024-05-27 14:26:20 +00:00
parent 4574ee7504
commit 4c2d8a1378
6 changed files with 7 additions and 17 deletions

View File

@ -1,5 +1,4 @@
#include <Interpreters/Context.h>
#include "Common/Exception.h"
#include <Common/TerminalSize.h>
#include "DisksApp.h"
#include "DisksClient.h"

View File

@ -227,9 +227,11 @@ void DisksApp::runInteractiveReplxx()
while (true)
{
String prompt = client->getCurrentDiskWithPath().getPrompt();
DiskWithPath disk_with_path = client->getCurrentDiskWithPath();
String prompt = "\x1b[1;34m" + disk_with_path.getDisk()->getName() + "\x1b[0m:" + "\x1b[1;31m" + disk_with_path.getCurrentPath()
+ "\x1b[0m$ ";
auto input = lr.readLine(prompt, ":-] ");
auto input = lr.readLine(prompt, "\x1b[1;31m:-] \x1b[0m");
if (input.empty())
break;

View File

@ -7,10 +7,6 @@
#include <Common/EventNotifier.h>
#include <Common/ZooKeeper/ZooKeeper.h>
#include <Common/filesystemHelpers.h>
#include "ICommand.h"
#include <cstring>
#include <memory>
#include <Disks/registerDisks.h>

View File

@ -1,6 +1,5 @@
#pragma once
#include <__tuple>
#include <filesystem>
#include <optional>
#include <string>
@ -8,10 +7,7 @@
#include <vector>
#include <Client/ReplxxLineReader.h>
#include <Loggers/Loggers.h>
#include "Disks/DiskSelector.h"
#include "Disks/IDisk.h"
#include "ICommand_fwd.h"
#include "IO/ReadHelpers.h"
#include <Interpreters/Context.h>
#include <boost/program_options/options_description.hpp>
@ -64,8 +60,6 @@ public:
}
}
String getPrompt() { return disk->getName() + ":" + path + "$ "; }
String getAbsolutePath(const String & any_path) const { return normalizePath(fs::path(path) / any_path); }
String getCurrentPath() const { return path; }

View File

@ -1,5 +1,4 @@
#include "ICommand.h"
#include <iostream>
#include "DisksClient.h"

View File

@ -23,7 +23,6 @@
namespace DB
{
// namespace po = boost::program_options;
namespace po = boost::program_options;
using ProgramOptionsDescription = po::options_description;
using PositionalProgramOptionsDescription = po::positional_options_description;
@ -127,7 +126,8 @@ DB::CommandPtr makeCommandRead();
DB::CommandPtr makeCommandRemove();
DB::CommandPtr makeCommandWrite();
DB::CommandPtr makeCommandMkDir();
DB::CommandPtr makeCommandPackedIO();
DB::CommandPtr makeCommandSwitchDisk();
#ifdef CLICKHOUSE_CLOUD
DB::CommandPtr makeCommandPackedIO();
#endif
}