From b559bd8130de88234b38a6769080076db1d03da7 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sun, 8 Sep 2024 01:24:02 +0300 Subject: [PATCH] Print json Just quick one, this can be improved with a dedicated struct. --- src/main.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index e005404..4a4c32f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,8 @@ use std::collections::BTreeSet; use std::io::Write; use std::sync::atomic::{AtomicBool, Ordering}; +use serde_json::json; + use crate::error::*; use crate::flake::*; use crate::opts::*; // TODO: how to avoid explicit import? @@ -154,13 +156,14 @@ fn main() -> Result<(), OldeError> { continue; } } - println!( - "repology {} {:?} | nixpkgs {:?} {:?}", - rn, - (*olv).clone().unwrap_or("".to_string()), - vs, - ats - ); + + let outdated_package = json!({ + "repology_name": rn, + "attribute": ats, + "repology_version": (*olv).clone().unwrap_or("".to_string()), + "nixpkgs_version": vs, + }); + println!("{}", outdated_package.to_string()); found_outdated += 1; }