diff --git a/Cargo.toml b/Cargo.toml index a8b166a..0a61e6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,4 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +clap = { version = "4.0", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index e7a11a9..f4c09ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,19 @@ +#![allow(unused)] +use clap::Parser; + +/// Search for a pattern in a file and display the lines that contain it. +#[derive(Parser)] + +struct Cli { + pattern: String, + path: std::path::PathBuf, +} + fn main() { - println!("Hello, world!"); + let args = Cli::parse(); + println!("pattern: {}", args.pattern); + println!( + "path: {}", + args.path.into_os_string().into_string().unwrap() + ); }