]> git.ipfire.org Git - oddments/collecty.git/commitdiff
client: Send --since= and --until
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Oct 2025 14:45:26 +0000 (14:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Oct 2025 14:45:26 +0000 (14:45 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/client/main.c

index 957b0987816b32fd4b606b9530501ea4745777ab..23e2166804f83498f43b09a2350345d1b756c428 100644 (file)
@@ -55,18 +55,30 @@ typedef struct td_client_ctx {
                uint64_t h;
                uint64_t w;
        } dimensions;
+
+       // Interval
+       struct {
+               const char* since;
+               const char* until;
+       } interval;
 } td_client_ctx;
 
 enum {
        OPT_FORMAT  = 1,
        OPT_HEIGHT  = 2,
        OPT_WIDTH   = 3,
+       OPT_SINCE   = 4,
+       OPT_UNTIL   = 5,
 };
 
 static struct argp_option options[] = {
        { "format", OPT_FORMAT, "FORMAT", 0, "Output Format", 0 },
        { "height", OPT_HEIGHT, "PIXELS", 0, "Height of the output image", 1 },
        { "width",  OPT_WIDTH,  "PIXELS", 0, "Width of the output image",  1 },
+
+       // Time
+       { "since",  OPT_SINCE, "TIMESTAMP", 0, "Start the graph from the specified date", 0 },
+       { "until",  OPT_UNTIL, "TIMESTAMP", 0, "End the graph at the specified date", 0 },
        { NULL },
 };
 
@@ -97,6 +109,14 @@ static error_t parse(int key, char* arg, struct argp_state* state) {
 
                        break;
 
+               case OPT_SINCE:
+                       ctx->interval.since = arg;
+                       break;
+
+               case OPT_UNTIL:
+                       ctx->interval.until = arg;
+                       break;
+
                // Called for each argument
                case ARGP_KEY_ARG:
                        // Take the graph name as first argument