add default url
This commit is contained in:
parent
58cf288a90
commit
bf88707844
1 changed files with 21 additions and 22 deletions
|
@ -25,7 +25,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
// sleep to avoid racing the server on startup when using cargo watch
|
||||
sleep(Duration::from_millis(200)).await;
|
||||
|
||||
if let Some(connect_addr) = env::args().nth(1) {
|
||||
let connect_addr = env::args()
|
||||
.nth(1)
|
||||
.unwrap_or_else(|| "ws://127.0.0.1:8080".to_string());
|
||||
let url = url::Url::parse(&connect_addr)?;
|
||||
|
||||
let (stdin_tx, stdin_rx) = futures_channel::mpsc::unbounded();
|
||||
|
@ -51,9 +53,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
pin_mut!(stdin_to_ws, ws_to_stdout);
|
||||
future::select(stdin_to_ws, ws_to_stdout).await;
|
||||
} else {
|
||||
eprintln!("This program requires at least one argument!")
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue