add: file content reading
This commit is contained in:
+21
-2
@@ -1,3 +1,22 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use log::{debug, error, info, trace, warn};
|
||||
use plume_log::{PlumeBuilder, success};
|
||||
|
||||
fn main(){
|
||||
PlumeBuilder::new()
|
||||
.with_level(log::LevelFilter::Trace)
|
||||
.init()
|
||||
.expect("Failed to init the logger");
|
||||
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let file_path = &args[1];
|
||||
info!("{}", file_path);
|
||||
|
||||
let contents = fs::read_to_string(file_path)
|
||||
.expect("File can't be read");
|
||||
|
||||
println!("{}", contents);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user