cat/cat.rs
1use repl_framework::Repl;
2fn main() -> std::io::Result<()> {
3 Repl::default()
4 .with_prompt("read:> ")
5 .with_function("", cat)
6 .with_function("help", help)
7 .run()
8}
9
10fn cat(_: &mut (), args: Vec<String>) {
11 args.into_iter().for_each(|f| {
12 println!("{}", std::fs::read_to_string(f).unwrap());
13 });
14}
15
16fn help(_: &mut (), _: Vec<String>) {
17 println!("help:\n\t[files] : prints contents of files")
18}