From a6e1c033133d885ccab60ea1431320dc071b84a3 Mon Sep 17 00:00:00 2001 From: Teemu Toivola Date: Thu, 28 Dec 2023 13:40:50 +0200 Subject: [PATCH] add -ic as alternative for --invert-colors --- CHANGES | 6 +++--- man/vnstati.1 | 6 ++++-- src/vnstati.c | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index f2f269a..e232b92 100644 --- a/CHANGES +++ b/CHANGES @@ -11,9 +11,9 @@ - Database queries resulting in error exit with status 1 - Show spinning animation at the beginning of -l / --live output line, visibility configurable using LiveSpinner configuration option - - Add --invert-colors option to image output for facilitating for example - dark mode switching without needing to have multiple separate color - configurations + - Add -ic / --invert-colors option to image output for facilitating for + example dark mode switching without needing to have multiple separate + color configurations - Add dark mode option to image output example cgi (examples/vnstat.cgi) - Add option 4 to QueryMode for selecting summary output of single interface regardless of the number of interfaces in the database diff --git a/man/vnstati.1 b/man/vnstati.1 index cf0cfe8..6a425e7 100644 --- a/man/vnstati.1 +++ b/man/vnstati.1 @@ -1,4 +1,4 @@ -.TH VNSTATI 1 "SEPTEMBER 2023" "version 2.12" "User Manuals" +.TH VNSTATI 1 "DECEMBER 2023" "version 2.12" "User Manuals" .SH NAME vnstati \- image output support for vnStat @@ -45,6 +45,8 @@ vnstati \- image output support for vnStat .IR interface ] .RB [ \-\-iface .IR interface ] +.RB [ \-ic +.RI [ mode ]] .RB [ \-\-invert\-colors .RI [ mode ]] .RB [ \-\-large ] @@ -254,7 +256,7 @@ can be used as parameter on the command line for selecting the used interface even without the option being explicitly used. .TP -.BI "--invert-colors " [mode] +.BI "-ic, --invert-colors " [mode] Invert image colors. Results in black becoming white, dark colors becoming light, light colors becoming dark and white becoming black. The optional .I mode diff --git a/src/vnstati.c b/src/vnstati.c index d02cdb6..9481c1b 100644 --- a/src/vnstati.c +++ b/src/vnstati.c @@ -134,6 +134,7 @@ void showihelp(const IPARAMS *p) printf(" -ne, --noedge remove edge from output\n"); printf(" -nl, --nolegend remove legend from output\n"); printf(" -ru, --rateunit [mode] swap configured rate unit\n"); + printf(" -ic, --invert-colors [mode] invert image colors\n\n"); printf(" -S, --small use small fonts"); if (!cfg.largefonts) { printf(" (default)"); @@ -166,8 +167,7 @@ void showihelp(const IPARAMS *p) #if HAVE_DECL_GD_NEAREST_NEIGHBOUR printf(" --scale change image size by scaling it\n"); #endif - printf(" --transparent [enabled] toggle background transparency\n"); - printf(" --invert-colors invert image colors (0-2)\n\n"); // TODO: add -ic short? + printf(" --transparent [enabled] toggle background transparency\n\n"); printf("See also \"man vnstati\".\n"); } @@ -525,7 +525,7 @@ void parseargs(IPARAMS *p, IMAGECONTENT *ic, int argc, char **argv) fprintf(stderr, "Error: Invalid or missing parameter for %s.\n", argv[currentarg]); exit(EXIT_FAILURE); } - } else if (strcmp(argv[currentarg], "--invert-colors") == 0) { + } else if ((strcmp(argv[currentarg], "-ic") == 0) || strcmp(argv[currentarg], "--invert-colors") == 0) { if (currentarg + 1 < argc && (strlen(argv[currentarg + 1]) == 1 || ishelprequest(argv[currentarg + 1]))) { if (!isdigit(argv[currentarg + 1][0]) || atoi(argv[currentarg + 1]) > 2 || atoi(argv[currentarg + 1]) < 0) { if (!ishelprequest(argv[currentarg + 1]))