diff options
Diffstat (limited to 'src/args.rs')
| -rw-r--r-- | src/args.rs | 43 |
1 files changed, 43 insertions, 0 deletions
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<u32>, + + /// Interface to use + #[arg(short = 'I', value_name = "interface")] + pub interface: Option<String>, + + /// number of seconds to wait between 2 pings + #[arg(short = 'i', value_name = "seconds")] + pub seconds: Option<f32>, + + /// the Time-to-live + #[arg(short = 't', long = "ttl", value_name = "TTL")] + pub ttl: Option<u32>, + + /// 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<bool>, + + /// 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<String>, +} |