Skip to content

Commit 42b52c4

Browse files
committed
Enhancing CLI help messages
1 parent e8f874f commit 42b52c4

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

src/args.rs

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::sync::Arc;
55
use std::path::Path;
66
use std::fs;
77

8+
use clap::builder::PossibleValue;
89
use clap::{Arg, ArgMatches, Command, ArgAction};
910
use ipnetwork::IpNetwork;
1011
use pnet_datalink::MacAddr;
@@ -52,17 +53,23 @@ pub fn build_args() -> Command {
5253
.arg(
5354
Arg::new("profile").short('p').long("profile")
5455
.value_name("PROFILE_NAME")
55-
.help("Scan profile")
56+
.value_parser([
57+
PossibleValue::new("default").help("Default scan profile"),
58+
PossibleValue::new("fast").help("Fast ARP scans (less accurate)"),
59+
PossibleValue::new("stealth").help("Slower scans (minimize impact)"),
60+
PossibleValue::new("chaos").help("Randomly-selected values")
61+
])
62+
.help("Scan profile - a preset of ARP scan options")
5663
)
5764
.arg(
5865
Arg::new("interface").short('i').long("interface")
5966
.value_name("INTERFACE_NAME")
60-
.help("Network interface")
67+
.help("Network interface (defaults to first 'up' interface with IPv4)")
6168
)
6269
.arg(
6370
Arg::new("network").short('n').long("network")
6471
.value_name("NETWORK_RANGE")
65-
.help("Network range to scan")
72+
.help("Network range to scan (defaults to first IPv4 network on the interface)")
6673
)
6774
.arg(
6875
Arg::new("file").short('f').long("file")
@@ -73,12 +80,12 @@ pub fn build_args() -> Command {
7380
.arg(
7481
Arg::new("timeout").short('t').long("timeout")
7582
.value_name("TIMEOUT_DURATION")
76-
.help("ARP response timeout")
83+
.help("ARP response timeout (2000ms)")
7784
)
7885
.arg(
7986
Arg::new("source_ip").short('S').long("source-ip")
8087
.value_name("SOURCE_IPV4")
81-
.help("Source IPv4 address for requests")
88+
.help("Source IPv4 address (defaults to IPv4 address on the interface)")
8289
)
8390
.arg(
8491
Arg::new("destination_mac").short('M').long("dest-mac")
@@ -88,7 +95,7 @@ pub fn build_args() -> Command {
8895
.arg(
8996
Arg::new("source_mac").long("source-mac")
9097
.value_name("SOURCE_MAC")
91-
.help("Source MAC address for requests")
98+
.help("Source MAC address for requests (default to 00:00:00:00:00:00)")
9299
)
93100
.arg(
94101
Arg::new("numeric").long("numeric")
@@ -103,7 +110,7 @@ pub fn build_args() -> Command {
103110
.arg(
104111
Arg::new("retry_count").short('r').long("retry")
105112
.value_name("RETRY_COUNT")
106-
.help("Host retry attempt count")
113+
.help("Host retry attempt count (default to 1)")
107114
)
108115
.arg(
109116
Arg::new("random").short('R').long("random")
@@ -113,7 +120,7 @@ pub fn build_args() -> Command {
113120
.arg(
114121
Arg::new("interval").short('I').long("interval")
115122
.value_name("INTERVAL_DURATION")
116-
.help("Milliseconds between ARP requests")
123+
.help("Milliseconds between ARP requests (defaults to 10ms)")
117124
)
118125
.arg(
119126
Arg::new("bandwidth").short('B').long("bandwidth")
@@ -124,17 +131,24 @@ pub fn build_args() -> Command {
124131
.arg(
125132
Arg::new("oui-file").long("oui-file")
126133
.value_name("FILE_PATH")
127-
.help("Path to custom IEEE OUI CSV file")
134+
.default_value("/usr/share/arp-scan/ieee-oui.csv")
135+
.help("Path to custom IEEE OUI CSV file for vendor lookup")
128136
)
129137
.arg(
130138
Arg::new("list").short('l').long("list")
131139
.action(ArgAction::SetTrue)
132140
.exclusive(true)
133-
.help("List network interfaces")
141+
.help("List network interfaces and exit")
134142
)
135143
.arg(
136144
Arg::new("output").short('o').long("output")
137145
.value_name("FORMAT")
146+
.value_parser([
147+
PossibleValue::new("plain").help("Verbose output with table"),
148+
PossibleValue::new("json").help("JSON format"),
149+
PossibleValue::new("yaml").help("YAML format"),
150+
PossibleValue::new("csv").help("CSV format")
151+
])
138152
.help("Define output format")
139153
)
140154
.arg(
@@ -166,7 +180,7 @@ pub fn build_args() -> Command {
166180
Arg::new("packet_help").long("packet-help")
167181
.action(ArgAction::SetTrue)
168182
.exclusive(true)
169-
.help("Print details about an ARP packet")
183+
.help("Print details about an ARP packet and exit")
170184
)
171185
.after_help(EXAMPLES_HELP)
172186
}

0 commit comments

Comments
 (0)