diff --git a/src/main.rs b/src/main.rs index d48b343..15052a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ #![allow(non_upper_case_globals)] -use std::{ env, fs::File, io::Read, thread::sleep, time::{ Duration, Instant } }; +use std::{ env, fs::{ self, File }, io::Read, thread::sleep, time::{ Duration, Instant } }; use anyhow::{ bail, Error as _Error, Result }; use const_format::formatcp; use serde::{ Serialize, Deserialize }; @@ -237,10 +237,10 @@ impl Retriever { bail!("Error during requesting Tilda: {:?}", request) } } - } + fn main () { dotenvy::dotenv().ok(); let cookie = read_cookie(cookie_filename).expect(&format!("Directory with executable should contain `{cookie_filename}` file containing a valid cookie for accessing Tilda control panel")); @@ -254,6 +254,12 @@ fn main () { match run { Ok(fetched) => { println!("Successfully fetched {} users in {} ms, writing out to {}…", fetched, benchmark.elapsed().as_millis(), out); + + let s = serde_json::to_string_pretty(&retriever.out).unwrap(); + + let write = fs::write(out, s); + + println!("{:?}", write); // @TODO write }, Err(e) => {