diff options
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/main.rs | 11 |
2 files changed, 11 insertions, 1 deletions
@@ -6,3 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +clap = { version = "4.0.2", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index e7a11a9..d1d7e5d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,12 @@ +use clap::Parser; + fn main() { - println!("Hello, world!"); + let args = Args::parse(); + println!("hello, {}", args.whom); +} + +#[derive(Parser)] +struct Args { + #[clap(default_value = "world")] + whom: String, } |