Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ttyplot for openSUSE:Factory checked in at 2025-04-07 18:41:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ttyplot (Old) and /work/SRC/openSUSE:Factory/.ttyplot.new.1907 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ttyplot" Mon Apr 7 18:41:49 2025 rev:2 rq:1267706 version:1.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ttyplot/ttyplot.changes 2024-09-17 18:20:19.452242774 +0200 +++ /work/SRC/openSUSE:Factory/.ttyplot.new.1907/ttyplot.changes 2025-04-07 18:41:56.556865790 +0200 @@ -1,0 +2,6 @@ +Wed Mar 19 19:57:21 UTC 2025 - Martin Hauke <mar...@gmx.de> + +- Update to version 1.7.1 + * add more colors for different elements. + +------------------------------------------------------------------- Old: ---- ttyplot-1.7.0.tar.gz New: ---- ttyplot-1.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ttyplot.spec ++++++ --- /var/tmp/diff_new_pack.OLaL6S/_old 2025-04-07 18:41:57.016885169 +0200 +++ /var/tmp/diff_new_pack.OLaL6S/_new 2025-04-07 18:41:57.020885339 +0200 @@ -1,7 +1,8 @@ # # spec file for package ttyplot # -# Copyright (c) 2023-2024, Martin Hauke <mar...@gmx.de> +# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2023-2025, Martin Hauke <mar...@gmx.de> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +18,7 @@ Name: ttyplot -Version: 1.7.0 +Version: 1.7.1 Release: 0 Summary: Realtime plotting utility for terminals License: Apache-2.0 @@ -33,7 +34,7 @@ display using reverse video for the second line. %prep -%setup -q +%autosetup -p1 %build %make_build CFLAGS="%{optflags} $(pkg-config --cflags --libs ncursesw)" ++++++ ttyplot-1.7.0.tar.gz -> ttyplot-1.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ttyplot-1.7.0/.github/workflows/codespell.yml new/ttyplot-1.7.1/.github/workflows/codespell.yml --- old/ttyplot-1.7.0/.github/workflows/codespell.yml 2024-08-02 04:32:02.000000000 +0200 +++ new/ttyplot-1.7.1/.github/workflows/codespell.yml 2025-03-19 17:11:39.000000000 +0100 @@ -21,7 +21,7 @@ steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: codespell-project/actions-codespell@94259cd8be02ad2903ba34a22d9c13de21a74461 # v2.0 + - uses: codespell-project/actions-codespell@406322ec52dd7b488e48c1c4b82e2a8b3a1bf630 # v2.1 with: # "nd" (with lowercase "n") is from ".Nd" (with uppercase "n") in ttyplot.1 # https://github.com/codespell-project/codespell/issues/3233#issuecomment-1828026522 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ttyplot-1.7.0/.github/workflows/linux_and_macos.yml new/ttyplot-1.7.1/.github/workflows/linux_and_macos.yml --- old/ttyplot-1.7.0/.github/workflows/linux_and_macos.yml 2024-08-02 04:32:02.000000000 +0200 +++ new/ttyplot-1.7.1/.github/workflows/linux_and_macos.yml 2025-03-19 17:11:39.000000000 +0100 @@ -23,44 +23,38 @@ matrix: include: - cc: gcc-14 - cxx: g++-14 clang_major_version: null clang_repo_suffix: null make: make runs-on: ubuntu-24.04 - cc: clang-18 - cxx: clang++-18 clang_major_version: 18 clang_repo_suffix: -18 make: bmake runs-on: ubuntu-22.04 - cc: musl-gcc - cxx: 'false' clang_major_version: null clang_repo_suffix: null make: bmake runs-on: ubuntu-22.04 - - cc: gcc-11 - cxx: g++-11 + - cc: gcc-12 clang_major_version: null clang_repo_suffix: null make: make runs-on: macos-12 - cc: gcc-13 - cxx: g++-13 clang_major_version: null clang_repo_suffix: null make: bmake runs-on: macos-12 - cc: clang-15 - cxx: clang++-15 clang_major_version: 15 clang_repo_suffix: null make: bsdmake runs-on: macos-12 steps: - name: Add Clang/LLVM repositories - if: "${{ runner.os == 'Linux' && contains(matrix.cxx, 'clang') }}" + if: "${{ runner.os == 'Linux' && contains(matrix.cc, 'clang') }}" run: |- set -x source /etc/os-release @@ -86,14 +80,14 @@ coreutils - name: Install build dependency Clang ${{ matrix.clang_major_version }} - if: "${{ runner.os == 'Linux' && contains(matrix.cxx, 'clang') }}" + if: "${{ runner.os == 'Linux' && contains(matrix.cc, 'clang') }}" run: |- sudo apt-get install --yes --no-install-recommends -V \ clang-${{ matrix.clang_major_version }} \ libclang-rt-${{ matrix.clang_major_version }}-dev - name: Add versioned aliases for Clang ${{ matrix.clang_major_version }} - if: "${{ runner.os == 'macOS' && contains(matrix.cxx, 'clang') }}" + if: "${{ runner.os == 'macOS' && contains(matrix.cc, 'clang') }}" run: |- set -x sudo ln -s "$(brew --prefix llvm@${{ matrix.clang_major_version }})"/bin/clang /usr/local/bin/clang-${{ matrix.clang_major_version }} @@ -145,7 +139,6 @@ - name: 'Build' env: CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} MAKE: ${{ matrix.make }} run: |- set -x @@ -193,7 +186,7 @@ rm -Rf recordings/venv/ - name: 'Upload UI test renderings for inspection' - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: name: ttyplot_ui_test_${{ github.sha }}_${{ matrix.runs-on }}_${{ matrix.cc }}_${{ matrix.make }} path: recordings/actual* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ttyplot-1.7.0/README.md new/ttyplot-1.7.1/README.md --- old/ttyplot-1.7.0/README.md 2024-08-02 04:32:02.000000000 +0200 +++ new/ttyplot-1.7.1/README.md 2025-03-19 17:11:39.000000000 +0100 @@ -201,6 +201,12 @@ { while true; do curl -s http://10.11.0.173:9100/metrics | awk '/^node_disk_.+_bytes_total{device="sda"}/ { printf("%f\n", $2/1024/1024); }'; sleep 1; done } | ttyplot -r -2 -u MB/s -t "10.11.0.173 sda writes" ``` +### using colors for different elements +``` +ping 8.8.8.8 | sed -u 's/^.*time=//g; s/ ms//g' | ttyplot -t "ping to 8.8.8.8" -u ms -C 2,3,4,5 +``` +This example sets color 2 (green) for the plot line, color 3 (yellow) for the axes, color 4 (blue) for the text, and color 5 (magenta) for the title and messages. + ### network throughput from collectd with rrdtool and awk ``` { while true; do rrdtool lastupdate /var/lib/collectd/rrd/$(hostname)/interface-enp1s0/if_octets.rrd | awk 'END { print ($2)/1000/1000, ($3)/1000/1000 }'; sleep 10; done } | ttyplot -2 -r -t "enp1s0 throughput" -u MB/s @@ -229,6 +235,13 @@ -M minimum value, if entered less than this, draws error symbol (see -E), lower-limit of the plot scale is fixed -t title of the plot -u unit displayed beside vertical bar + -C color[,axes,text,title] set colors (0-7) for elements: + First value: plot line color + Second value: axes color (optional) + Third value: text color (optional) + Fourth value: title color (optional) + Example: -C 1,2,3,4 or -C 1,2 or -C 1 + Colors: 0=black, 1=red, 2=green, 3=yellow, 4=blue, 5=magenta, 6=cyan, 7=white -v print the current version and exit -h print this help message and exit ``` @@ -290,8 +303,7 @@ ## legal stuff ``` License: Apache 2.0 -Copyright (c) 2013-2018 Antoni Sawicki -Copyright (c) 2019-2024 Google LLC +Copyright (c) 2013-2025 Antoni Sawicki Copyright (c) 2023 Edgar Bonet Copyright (c) 2023 Sebastian Pipping ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ttyplot-1.7.0/ttyplot.c new/ttyplot-1.7.1/ttyplot.c --- old/ttyplot-1.7.0/ttyplot.c 2024-08-02 04:32:02.000000000 +0200 +++ new/ttyplot-1.7.1/ttyplot.c 2025-03-19 17:11:39.000000000 +0100 @@ -1,7 +1,6 @@ // // ttyplot: a realtime plotting utility for terminal with data input from stdin -// Copyright (c) 2018-2024 by Antoni Sawicki -// Copyright (c) 2019-2023 by Google LLC +// Copyright (c) 2018-2025 by Antoni Sawicki // Copyright (c) 2023-2024 by Edgar Bonet // Copyright (c) 2023-2024 by Sebastian Pipping // Apache License 2.0 @@ -46,7 +45,7 @@ #define STR(x) STR_(x) #define VERSION_MAJOR 1 #define VERSION_MINOR 7 -#define VERSION_PATCH 0 +#define VERSION_PATCH 1 #define VERSION_STR STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_PATCH) #define T_RARR '>' @@ -82,7 +81,8 @@ static bool fake_clock = false; static char *errstr = NULL; static bool redraw_needed = false; -static int plot_color = -1; // -1 means no color specified +// Color indices: 0=plot_line, 1=axes, 2=text, 3=title +static int colors[4] = {-1, -1, -1, -1}; // -1 means no color specified static const char *verstring = "https://github.com/tenox7/ttyplot " VERSION_STR; static void usage(void) { @@ -107,7 +107,12 @@ "lower-limit of the plot scale is fixed\n" " -t title of the plot\n" " -u unit displayed beside vertical bar\n" - " -C color set the color of the plot line (0-7 for basic colors)\n" + " -C color[,axes,text,title] set colors (0-7) for elements:\n" + " First value: plot line color\n" + " Second value: axes color (optional)\n" + " Third value: text color (optional)\n" + " Fourth value: title color (optional)\n" + " Example: -C 1,2,3,4 or -C 1,2 or -C 1\n" " -v print the current version and exit\n" " -h print this help message and exit\n" "\n" @@ -170,17 +175,34 @@ } static void draw_axes(int h, int ph, int pw, double max, double min, char *unit) { + // Apply axes color if specified + if (colors[1] != -1) + attron(COLOR_PAIR(2)); + + // Draw axes mvhline(h - 3, 2, T_HLINE, pw); mvvline(2, 2, T_VLINE, ph); + mvaddch(h - 3, 2 + pw, T_RARR); + mvaddch(1, 2, T_UARR); + mvaddch(h - 3, 2, T_LLCR); + + if (colors[1] != -1) + attroff(COLOR_PAIR(2)); + + // Apply text color for scale labels if specified + if (colors[2] != -1) + attron(COLOR_PAIR(3)); + + // Print scale labels if (max - min >= 0.1) { mvprintw(1, 4, "%.1f %s", max, unit); mvprintw((ph / 4) + 1, 4, "%.1f %s", min / 4 + max * 3 / 4, unit); mvprintw((ph / 2) + 1, 4, "%.1f %s", min / 2 + max / 2, unit); mvprintw((ph * 3 / 4) + 1, 4, "%.1f %s", min * 3 / 4 + max / 4, unit); } - mvaddch(h - 3, 2 + pw, T_RARR); - mvaddch(1, 2, T_UARR); - mvaddch(h - 3, 2, T_LLCR); + + if (colors[2] != -1) + attroff(COLOR_PAIR(3)); } static void draw_line(int x, int ph, int l1, int l2, cchar_t *c1, cchar_t *c2, @@ -190,7 +212,7 @@ c1r.attr |= A_REVERSE; c2r.attr |= A_REVERSE; - if (plot_color != -1) { + if (colors[0] != -1) { c1->attr |= COLOR_PAIR(1); c2->attr |= COLOR_PAIR(1); c1r.attr |= COLOR_PAIR(1); @@ -208,7 +230,7 @@ mvvline_set(ph + 1 - l2, x, &c2r, l2); } - if (plot_color != -1) { + if (colors[0] != -1) { c1->attr &= ~COLOR_PAIR(1); c2->attr &= ~COLOR_PAIR(1); c1r.attr &= ~COLOR_PAIR(1); @@ -225,7 +247,7 @@ int x; int l1, l2; - if (plot_color != -1) + if (colors[0] != -1) attron(COLOR_PAIR(1)); for (x = first_col; x < first_col + pw; x++, i = (i + 1) % pw) { @@ -259,7 +281,7 @@ hce, lce); } - if (plot_color != -1) + if (colors[0] != -1) attroff(COLOR_PAIR(1)); } @@ -267,7 +289,15 @@ const size_t message_len = strlen(message); const int x = ((int)message_len > width) ? 0 : (width / 2 - (int)message_len / 2); const int y = height / 2; + + // Apply title color to error messages if specified + if (colors[3] != -1) + attron(COLOR_PAIR(4)); + mvaddnstr(y, x, message, width); + + if (colors[3] != -1) + attroff(COLOR_PAIR(4)); } static int window_big_enough_to_draw(void) { @@ -306,6 +336,10 @@ if (hardmin != -FLT_MAX) min = hardmin; + // Apply text color if specified + if (colors[2] != -1) + attron(COLOR_PAIR(3)); + mvaddstr(height - 1, width - strlen(verstring) - 1, verstring); const char *clock_display; @@ -318,6 +352,13 @@ } mvaddstr(height - 2, width - strlen(clock_display), clock_display); + if (colors[2] != -1) + attroff(COLOR_PAIR(3)); + + // Apply text color for stats + if (colors[2] != -1) + attron(COLOR_PAIR(3)); + mvvline_set(height - 2, 5, &plotchar, 1); if (v > 0) { mvprintw(height - 2, 7, "last=%.1f min=%.1f max=%.1f avg=%.1f %s ", values1[n], @@ -333,13 +374,23 @@ } } + if (colors[2] != -1) + attroff(COLOR_PAIR(3)); + plot_values(plotheight, plotwidth, values1, two ? values2 : NULL, max, min, n, &plotchar, &max_errchar, &min_errchar, hardmax, hardmin); draw_axes(height, plotheight, plotwidth, max, min, unit); + // Apply title color if specified + if (colors[3] != -1) + attron(COLOR_PAIR(4)); + mvaddstr(0, (width / 2) - (strlen(title) / 2), title); + if (colors[3] != -1) + attroff(COLOR_PAIR(4)); + move(0, 0); } @@ -653,9 +704,19 @@ case 'E': mbtowc(&min_errchar.chars[0], optarg, MB_CUR_MAX); break; - case 'C': - plot_color = atoi(optarg); + case 'C': { + char *color_str = strdup(optarg); + char *token = strtok(color_str, ","); + int color_idx = 0; + + while (token != NULL && color_idx < 4) { + colors[color_idx++] = atoi(token); + token = strtok(NULL, ","); + } + + free(color_str); break; + } case 's': softmax = atof(optarg); break; @@ -691,10 +752,30 @@ err(1, "pledge"); #endif - if (plot_color != -1) { + // Check if any colors are defined + bool has_colors = false; + for (int i = 0; i < 4; i++) { + if (colors[i] != -1) { + has_colors = true; + break; + } + } + + if (has_colors) { start_color(); use_default_colors(); - init_pair(1, plot_color, -1); // -1 for default background + + // Initialize color pairs for different elements + // COLOR_PAIR(1): plot line (initialized in original code) + // COLOR_PAIR(2): axes + // COLOR_PAIR(3): text + // COLOR_PAIR(4): title + + for (int i = 0; i < 4; i++) { + if (colors[i] != -1) { + init_pair(i+1, colors[i], -1); // -1 for default background + } + } } gettimeofday(&now, NULL);