Add logic for reading files
This commit is contained in:
parent
ab76644498
commit
c65f7203a1
1 changed files with 6 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::env;
|
||||
use std::fs;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
@ -8,4 +9,9 @@ fn main() {
|
|||
|
||||
println!("Searching for {query}");
|
||||
println!("In file {file_path}");
|
||||
|
||||
let contents = fs::read_to_string(file_path)
|
||||
.expect("Should have been able to read the file");
|
||||
|
||||
println!("With text:\n{contents}");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue