From 9dbbbc4fe5d85e917e8efa977501b4ebacb349be Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Sat, 2 Dec 2023 22:10:34 +0100 Subject: =?UTF-8?q?use=20tree=20for=20day1,=20why=20not=20=F0=9F=90=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/cli.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/bin/cli.rs (limited to 'src/bin/cli.rs') diff --git a/src/bin/cli.rs b/src/bin/cli.rs new file mode 100644 index 0000000..49c35a8 --- /dev/null +++ b/src/bin/cli.rs @@ -0,0 +1,20 @@ +use clap::Parser; + +#[derive(Parser)] +struct Cli { + pattern: String, + path: std::path::PathBuf, +} + +fn main() -> Result<(), Box> { + let args = Cli::parse(); + let result = std::fs::read_to_string(&args.path); + let content = match result { + Ok(content) => content, + Err(error) => { + return Err(error.into()); + } + }; + println!("file content: {}", content); + Ok(()) +} -- cgit v1.2.3