From 9a24747aef601477dd22be0b1525bad2a07b84fd Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 2 Oct 2025 19:25:18 +0000 Subject: [PATCH] graph: Allow to specify the output format Signed-off-by: Michael Tremer --- src/daemon/graph.c | 7 +++++++ src/daemon/graph.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/daemon/graph.c b/src/daemon/graph.c index 5da89e2..87fe204 100644 --- a/src/daemon/graph.c +++ b/src/daemon/graph.c @@ -203,6 +203,13 @@ int collecty_graph_render(collecty_graph* self, const char* object, if (r < 0) goto ERROR; + // Select the output format + if (options->format) { + r = collecty_args_push(args, "--imgformat=%s", options->format); + if (r < 0) + goto ERROR; + } + // Write the graph to the output stream r = collecty_args_push(args, "-"); if (r < 0) diff --git a/src/daemon/graph.h b/src/daemon/graph.h index 968e48c..043ad66 100644 --- a/src/daemon/graph.h +++ b/src/daemon/graph.h @@ -52,7 +52,7 @@ int collecty_graph_require_module(collecty_graph* self, collecty_args* args, const char* name, const char* object); typedef struct collecty_graph_render_options { - // XXX TODO + const char* format; } collecty_graph_render_options; int collecty_graph_render(collecty_graph* self, const char* object, -- 2.47.3