--- a/bash-completion.sh Mon Jun 20 00:55:56 2022 +0200
+++ b/bash-completion.sh Fri Jul 01 22:56:30 2022 +0200
@@ -36,7 +36,8 @@
)
COLOR_SCHEMES=(
- "green-screen"
+ "greenish"
+ "amberish"
"monochrome"
"midnight"
)
@@ -46,7 +47,7 @@
elif [[ "$w1" == "--write-relation-name" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
elif [[ "$w1" == "--write-record-count" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
elif [[ "$w1" == "--table-style" ]]; then COMPREPLY=($(compgen -W "${TABLE_STYLES[*]}" -- "$w0"))
- elif [[ "$w1" == "--color-scheme" ]]; then COMPREPLY=($(compgen -W "${COLOR_SCHEMES[*]}" -- "$w0"))
+ elif [[ "$w1" == "--color-scheme" ]]; then COMPREPLY=($(compgen -W "${COLOR_SCHEMES[*]}" -- "$w0"))
else
OPTIONS=(
"--relation"
--- a/src/CLIParser.h Mon Jun 20 00:55:56 2022 +0200
+++ b/src/CLIParser.h Fri Jul 01 22:56:30 2022 +0200
@@ -59,7 +59,8 @@
}
Configuration::ColorScheme parseColorScheme(const relpipe::reader::string_t& value) {
- if (value == L"green-screen") return Configuration::ColorScheme::GreenScreen;
+ if (value == L"greenish") return Configuration::ColorScheme::Greenish;
+ else if (value == L"amberish") return Configuration::ColorScheme::Amberish;
else if (value == L"monochrome") return Configuration::ColorScheme::Monochrome;
else if (value == L"midnight") return Configuration::ColorScheme::Midnight;
else throw relpipe::cli::RelpipeCLIException(L"Unable to parse ColorScheme value: " + value + L" (expecting green-screen, monochrome or midnight)", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
--- a/src/Configuration.h Mon Jun 20 00:55:56 2022 +0200
+++ b/src/Configuration.h Fri Jul 01 22:56:30 2022 +0200
@@ -42,7 +42,8 @@
public:
enum class ColorScheme {
- GreenScreen,
+ Greenish,
+ Amberish,
Monochrome,
Midnight
};
@@ -60,7 +61,7 @@
relpipe::reader::boolean_t writeRecordCount = true;
relpipe::reader::boolean_t writeRelationName = true;
std::vector<RelationConfiguration> relationConfigurations;
- ColorScheme colorScheme = ColorScheme::GreenScreen;
+ ColorScheme colorScheme = ColorScheme::Greenish;
TableStyle tableStyle = TableStyle::Rounded;
virtual ~Configuration() {
--- a/src/TabularPrefetchingHandler.h Mon Jun 20 00:55:56 2022 +0200
+++ b/src/TabularPrefetchingHandler.h Fri Jul 01 22:56:30 2022 +0200
@@ -40,6 +40,10 @@
class TabularPrefetchingHandler : public handlers::RelationalReaderStringHandler {
private:
+
+ class ColorScheme {
+ };
+
std::wstring_convert<std::codecvt_utf8<wchar_t>> convertor; // TODO: support also other encodings.
const char* ESC_BRIGHT = "\u001b[1m";
const char* ESC_RED = "\u001b[31m";
@@ -51,7 +55,9 @@
const char* ESC_HEADER = ESC_BRIGHT;
const char* ESC_BORDER = ESC_GREEN;
const char* ESC_VALUE = ESC_CYAN;
+ const char* ESC_RELATION = ESC_RED;
const char* ESC_REPLACEMENT = ESC_RED;
+ const char* ESC_COUNT = ESC_YELLOW;
const char* INDENT = " "; // table indent from the left
@@ -220,7 +226,7 @@
if (getConfiguration(writeRecordCount)) {
integer_t recordCount = values.size() / columnCount;
- output << ESC_YELLOW << "Record count: " << ESC_RESET << recordCount << std::endl;
+ output << ESC_COUNT << "Record count: " << ESC_RESET << recordCount << std::endl;
}
values.clear();
@@ -242,7 +248,7 @@
}
}
- if (getConfiguration(writeRelationName)) output << ESC_RED << convertor.to_bytes(name) << ":" << ESC_RESET << endl;
+ if (getConfiguration(writeRelationName)) output << ESC_RELATION << convertor.to_bytes(name) << ":" << ESC_RESET << endl;
columnCount = attributes.size();
columnTypes.resize(columnCount);
columnTypeCodes.resize(columnCount);