rustlings/src/dev/check.rs

19 lines
424 B
Rust
Raw Normal View History

2024-04-15 21:30:28 -04:00
use std::fs;
2024-04-15 17:54:57 -04:00
2024-04-15 21:30:28 -04:00
use anyhow::{Context, Result};
use crate::{info_file::InfoFile, init::cargo_toml};
pub fn check(info_file: InfoFile) -> Result<()> {
// TODO: Add checks
2024-04-15 21:43:34 -04:00
// TODO: Keep dependencies!
2024-04-15 21:30:28 -04:00
fs::write("Cargo.toml", cargo_toml(&info_file.exercises))
.context("Failed to update the file `Cargo.toml`")?;
2024-04-15 21:35:23 -04:00
println!("Updated `Cargo.toml`");
2024-04-15 21:30:28 -04:00
2024-04-15 21:35:23 -04:00
println!("\nEverything looks fine!");
2024-04-15 21:30:28 -04:00
Ok(())
2024-04-15 17:54:57 -04:00
}