Skip to content

Commit 690b9fa

Browse files
committed
Show command line arguments
1 parent e6ce562 commit 690b9fa

File tree

1 file changed

+22
-3
lines changed
  • src/tools/remote-test-server/src

1 file changed

+22
-3
lines changed

src/tools/remote-test-server/src/main.rs

+22-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ impl Config {
7474
"--bind" => next_is_bind = true,
7575
"--sequential" => config.sequential = true,
7676
"--verbose" | "-v" => config.verbose = true,
77-
arg => panic!("unknown argument: {}", arg),
77+
"--help" | "-h" => {
78+
show_help();
79+
std::process::exit(0);
80+
}
81+
arg => panic!("unknown argument: {}, use `--help` for known arguments", arg),
7882
}
7983
}
8084
if next_is_bind {
@@ -85,16 +89,31 @@ impl Config {
8589
}
8690
}
8791

92+
fn show_help() {
93+
eprintln!(
94+
r#"Usage:
95+
96+
{} [OPTIONS]
97+
98+
OPTIONS:
99+
--bind <IP>:<PORT> Specify IP address and port to listen for requests, e.g. "0.0.0.0:12345"
100+
--sequential Run only one test at a time
101+
-v, --verbose Show status messages
102+
-h, --help Show this help screen
103+
"#,
104+
std::env::args().next().unwrap()
105+
);
106+
}
107+
88108
fn print_verbose(s: &str, conf: Config) {
89109
if conf.verbose {
90110
println!("{}", s);
91111
}
92112
}
93113

94114
fn main() {
95-
println!("starting test server");
96-
97115
let config = Config::parse_args();
116+
println!("starting test server");
98117

99118
let listener = t!(TcpListener::bind(config.bind));
100119
let (work, tmp): (PathBuf, PathBuf) = if cfg!(target_os = "android") {

0 commit comments

Comments
 (0)