use crate::config::Configuration; use std::fs; use std::path::Path; pub fn generate_config() { let json_file = String::from("config.json"); if !Path::new(&json_file).exists() { let generate = Configuration { api_token: Some("".to_string()), base_api: "/api/v1".to_string(), base_url: "https://gitea.com".to_string(), username: Some("gitea".to_string()), password: Some("".to_string()), }; let json = serde_json::to_string(&generate).unwrap(); fs::write(json_file, json).expect("Failed to write file."); } }