From dbad76baac9911d692ebc78335cbc51554443344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Sat, 11 Jan 2020 15:00:15 -0700 Subject: Parse command line arguments --- src/main.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index e7a11a9..4277e8c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,15 @@ +use structopt::StructOpt; + +#[derive(Debug, StructOpt)] +struct Cli { + /// The pattern to look for + pattern: String, + /// The path to the file to read + #[structopt(parse(from_os_str))] + path: std::path::PathBuf, +} + fn main() { - println!("Hello, world!"); + let args = Cli::from_args(); + println!("{:?}", args); } -- cgit v1.2.3