diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-10-17 13:11:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-17 13:11:07 +0200 |
| commit | 9a615fd4e4ffbf9e58c56d15454ccfebff549f7c (patch) | |
| tree | b47ff375d08780ab841a290f1b7bf0d28e232172 /src | |
| parent | c19a893f87e70fc1c9bab193c3f9c83d9a9d71d3 (diff) | |
| parent | 690b9faa5644e336d57a608110578d91c7ef9209 (diff) | |
| download | rust-9a615fd4e4ffbf9e58c56d15454ccfebff549f7c.tar.gz rust-9a615fd4e4ffbf9e58c56d15454ccfebff549f7c.zip | |
Rollup merge of #102962 - flba-eb:remote_test_server_help, r=pietroalbini
remote-test-server: Show command line arguments The user of remote-test-server should get at least some minimal command line help as this is often started manually. r? `@pietroalbini`
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/remote-test-server/src/main.rs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index bed9d39161d..ec992da6812 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -74,7 +74,11 @@ impl Config { "--bind" => next_is_bind = true, "--sequential" => config.sequential = true, "--verbose" | "-v" => config.verbose = true, - arg => panic!("unknown argument: {}", arg), + "--help" | "-h" => { + show_help(); + std::process::exit(0); + } + arg => panic!("unknown argument: {}, use `--help` for known arguments", arg), } } if next_is_bind { @@ -85,6 +89,22 @@ impl Config { } } +fn show_help() { + eprintln!( + r#"Usage: + +{} [OPTIONS] + +OPTIONS: + --bind <IP>:<PORT> Specify IP address and port to listen for requests, e.g. "0.0.0.0:12345" + --sequential Run only one test at a time + -v, --verbose Show status messages + -h, --help Show this help screen +"#, + std::env::args().next().unwrap() + ); +} + fn print_verbose(s: &str, conf: Config) { if conf.verbose { println!("{}", s); @@ -92,9 +112,8 @@ fn print_verbose(s: &str, conf: Config) { } fn main() { - println!("starting test server"); - let config = Config::parse_args(); + println!("starting test server"); let listener = t!(TcpListener::bind(config.bind)); let (work, tmp): (PathBuf, PathBuf) = if cfg!(target_os = "android") { |
