From 8f1c2377b90532a7bde3d0fddc4a62e1315ce170 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Wed, 10 Aug 2022 18:41:08 +0200 Subject: [PATCH] CLI args testing --- Cargo.toml | 1 + src/cli.rs | 11 +++++++++++ src/main.rs | 1 + 3 files changed, 13 insertions(+) create mode 100644 src/cli.rs diff --git a/Cargo.toml b/Cargo.toml index 78b3d13..76826c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,3 +9,4 @@ edition = "2021" anyhow = "1" log = "0.4" convert-base = "1.1.2" +clap = "3.2.16" diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..44dc856 --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,11 @@ +use clap::Parser; + +#[derive(Parser, Debug)] +#[clap(author, version, about, long_about = None)] +struct Args { + #[clap(short, long, value_parser)] + name: String, + + #[clap(short, long, value_parser, defualt_value_t = 1)] + count: u8 +} diff --git a/src/main.rs b/src/main.rs index c536bf0..a5ea142 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ mod ipv4; mod scanner; mod util; +mod cli; //use ipv4::IPv4;