chore: add simply logging

This commit is contained in:
Dmitriy Pleshevskiy 2021-01-31 03:34:38 +03:00
parent 7aa350f2ba
commit bc3421b150

View File

@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
const MIGRA_TOML_FILENAME: &str = "migra.toml"; const MIGRA_TOML_FILENAME: &str = "Migra.toml";
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub(crate) struct Config { pub(crate) struct Config {
@ -27,6 +27,7 @@ impl Config {
pub fn initialize() -> Result<(), Box<dyn std::error::Error>> { pub fn initialize() -> Result<(), Box<dyn std::error::Error>> {
if Path::new(MIGRA_TOML_FILENAME).exists() { if Path::new(MIGRA_TOML_FILENAME).exists() {
println!("{} already exists", MIGRA_TOML_FILENAME);
return Ok(()); return Ok(());
} }
@ -34,6 +35,8 @@ impl Config {
let content = toml::to_string(&config)?; let content = toml::to_string(&config)?;
fs::write(MIGRA_TOML_FILENAME, content)?; fs::write(MIGRA_TOML_FILENAME, content)?;
println!("Created {}", MIGRA_TOML_FILENAME);
Ok(()) Ok(())
} }
} }