From aecb7ac234ddb38772f3a968c3fa43ec3b507315 Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 4 Aug 2026 09:43:58 +0200 Subject: Init commit --- src/args.rs | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/args.rs (limited to 'src/args.rs') diff --git a/src/args.rs b/src/args.rs new file mode 100644 index 0000000..09de553 --- /dev/null +++ b/src/args.rs @@ -0,0 +1,43 @@ +use clap::{Parser, ArgAction}; + +#[derive(Parser, Debug)] +#[command(name = "ping")] +#[command(about = "A ping program")] +#[command(disable_help_flag = true)] +pub struct Args { + /// Beep on each ping + #[arg(short = 'a', long = "beep", action = ArgAction::SetTrue)] + pub beep: bool, + + /// Number of ping to make + #[arg(short = 'c', long = "count", value_name = "count")] + pub count: Option, + + /// Interface to use + #[arg(short = 'I', value_name = "interface")] + pub interface: Option, + + /// number of seconds to wait between 2 pings + #[arg(short = 'i', value_name = "seconds")] + pub seconds: Option, + + /// the Time-to-live + #[arg(short = 't', long = "ttl", value_name = "TTL")] + pub ttl: Option, + + /// Show the statistics + #[arg(short = 's', long = "stats", action = ArgAction::SetTrue)] + pub stats: bool, + + /// Print the Help line + #[arg(short = 'H', action = ArgAction::Help, required = false)] + pub help: Option, + + /// Print the remainder line + #[arg(short = 'l', long = "remainder", action = ArgAction::SetTrue)] + pub remainder: bool, + + /// Target IP address + #[arg(value_name = "target")] + pub target: Option, +} -- cgit v1.3-2-g11bf