tidy table a little.
This commit is contained in:
parent
b64ade4d04
commit
40b992efeb
@ -181,6 +181,13 @@ void process_line(WINDOW* win, const std::string& text, const std::map<std::stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip control characters (except newline, tab, and others that should be displayed)
|
||||||
|
unsigned char ch = static_cast<unsigned char>(text[pos]);
|
||||||
|
if (ch < 32 && ch != '\t' && ch != '\n' && ch != '\r') {
|
||||||
|
pos++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Print the character as-is
|
// Print the character as-is
|
||||||
waddch(win, text[pos]);
|
waddch(win, text[pos]);
|
||||||
pos++;
|
pos++;
|
||||||
@ -286,6 +293,8 @@ fullscreen_window::~fullscreen_window() {
|
|||||||
void fullscreen_window::clear_display()
|
void fullscreen_window::clear_display()
|
||||||
{
|
{
|
||||||
werase(display_win);
|
werase(display_win);
|
||||||
|
wclear(display_win); // Also call wclear for complete clearing
|
||||||
|
wmove(display_win, 0, 0); // Move cursor to top-left position
|
||||||
wrefresh(display_win);
|
wrefresh(display_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,12 +109,12 @@ void show_server_details(const std::string& server_name) {
|
|||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
std::cout << "Status: Online" << std::endl;
|
std::cout << "Status: Online" << std::endl;
|
||||||
|
|
||||||
// Get uptime if possible
|
// // Get uptime if possible
|
||||||
cmd = "ssh " + ssh_address + " 'uptime' 2>/dev/null";
|
// cmd = "ssh " + ssh_address + " 'uptime' 2>/dev/null";
|
||||||
int rval = system(cmd.c_str());
|
// int rval = system(cmd.c_str());
|
||||||
if (rval != 0) {
|
// if (rval != 0) {
|
||||||
std::cout << "Error: Failed to get uptime" << std::endl;
|
// std::cout << "Error: Failed to get uptime" << std::endl;
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Status: Offline" << std::endl;
|
std::cout << "Status: Offline" << std::endl;
|
||||||
}
|
}
|
||||||
@ -123,6 +123,7 @@ void show_server_details(const std::string& server_name) {
|
|||||||
|
|
||||||
//---------------------
|
//---------------------
|
||||||
{
|
{
|
||||||
|
std::cout << std::endl;
|
||||||
tableprint tp("Server Configuration: " + server_name, true);
|
tableprint tp("Server Configuration: " + server_name, true);
|
||||||
tp.add_row({"Key", "Value"});
|
tp.add_row({"Key", "Value"});
|
||||||
for (const auto& [key, value] : env.get_variables()) {
|
for (const auto& [key, value] : env.get_variables()) {
|
||||||
|
@ -195,7 +195,7 @@ void tableprint::print() {
|
|||||||
std::cout << "+";
|
std::cout << "+";
|
||||||
for (size_t i = 0; i < rows[0].size(); ++i) {
|
for (size_t i = 0; i < rows[0].size(); ++i) {
|
||||||
std::cout << std::string(col_widths[i] + 2, '-');
|
std::cout << std::string(col_widths[i] + 2, '-');
|
||||||
if (i < rows[0].size() - 1) std::cout << "+";
|
if (i < rows[0].size() - 1) std::cout << "-";
|
||||||
}
|
}
|
||||||
std::cout << "+" << std::endl;
|
std::cout << "+" << std::endl;
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ void tableprint::print() {
|
|||||||
} else {
|
} else {
|
||||||
// Print top border if no title
|
// Print top border if no title
|
||||||
std::cout << "\033[90m"; // Dark grey color for borders
|
std::cout << "\033[90m"; // Dark grey color for borders
|
||||||
std::cout << "┌";
|
std::cout << "+";
|
||||||
for (size_t i = 0; i < rows[0].size(); ++i) {
|
for (size_t i = 0; i < rows[0].size(); ++i) {
|
||||||
std::cout << std::string(col_widths[i] + 2, '-');
|
std::cout << std::string(col_widths[i] + 2, '-');
|
||||||
if (i < rows[0].size() - 1) std::cout << "+";
|
if (i < rows[0].size() - 1) std::cout << "+";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user