diff --git a/src/main.rs b/src/main.rs index 2aada4d..44b731e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,25 @@ #![allow(unused_imports)] use std::env; -use std::fs; +use std::fs::File; +use std::io::{BufRead, BufReader}; use log::{debug, error, info, trace, warn}; use plume_log::{PlumeBuilder, success}; -fn main(){ +fn main() -> std::io::Result<()>{ PlumeBuilder::new() .with_level(log::LevelFilter::Trace) .init() .expect("Failed to init the logger"); let args: Vec = env::args().collect(); - let file_path = &args[1]; - info!("{}", file_path); + info!("File: {}", &args[1]); + let file = File::open(&args[1])?; + let reader = BufReader::new(file); - let contents = fs::read_to_string(file_path) - .expect("File can't be read"); + for line in reader.lines() { + println!("+ {}", line?); + } - println!("{}", contents); + Ok(()) }