diff options
| author | Mike Vink <ivi@vinkies.net> | 2023-12-02 22:10:34 +0100 |
|---|---|---|
| committer | Mike Vink <ivi@vinkies.net> | 2023-12-10 20:35:22 +0100 |
| commit | 9dbbbc4fe5d85e917e8efa977501b4ebacb349be (patch) | |
| tree | 06339fa764a7dacd9b1f6e2093e0e9cdba4c2f8b /src/bin/cli.rs | |
use tree for day1, why not 🐒
Diffstat (limited to 'src/bin/cli.rs')
| -rw-r--r-- | src/bin/cli.rs | 20 |
1 files changed, 20 insertions, 0 deletions
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<dyn std::error::Error>> { + 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(()) +} |
