File tree 1 file changed +22
-3
lines changed
src/tools/remote-test-server/src
1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,11 @@ impl Config {
74
74
"--bind" => next_is_bind = true ,
75
75
"--sequential" => config. sequential = true ,
76
76
"--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) ,
78
82
}
79
83
}
80
84
if next_is_bind {
@@ -85,16 +89,31 @@ impl Config {
85
89
}
86
90
}
87
91
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
+
88
108
fn print_verbose ( s : & str , conf : Config ) {
89
109
if conf. verbose {
90
110
println ! ( "{}" , s) ;
91
111
}
92
112
}
93
113
94
114
fn main ( ) {
95
- println ! ( "starting test server" ) ;
96
-
97
115
let config = Config :: parse_args ( ) ;
116
+ println ! ( "starting test server" ) ;
98
117
99
118
let listener = t ! ( TcpListener :: bind( config. bind) ) ;
100
119
let ( work, tmp) : ( PathBuf , PathBuf ) = if cfg ! ( target_os = "android" ) {
You can’t perform that action at this time.
0 commit comments