chore: Moved spinner to beginning of command
116cbb55
1 file(s) · +13 −12
| 283 | 283 | ||
| 284 | 284 | let mut tasks: Vec<JoinHandle<Result<BalanceResult, Box<dyn Error + Send + Sync>>>> = Vec::new(); |
|
| 285 | 285 | ||
| 286 | - | let spinner = ProgressBar::new_spinner(); |
|
| 287 | - | spinner.set_style( |
|
| 288 | - | ProgressStyle::default_spinner() |
|
| 289 | - | .tick_chars("⠁⠂⠄⡀⢀⠠⠐⠈ ") |
|
| 290 | - | .template("{spinner:.green} {msg}") |
|
| 291 | - | .unwrap() |
|
| 292 | - | ); |
|
| 293 | - | spinner.set_message("Fetching balances..."); |
|
| 294 | - | spinner.enable_steady_tick(std::time::Duration::from_millis(100)); |
|
| 295 | - | ||
| 296 | 286 | for (_, network) in &networks { |
|
| 297 | 287 | let client_clone = client.clone(); |
|
| 298 | 288 | let address_clone = address.to_string(); |
|
| 321 | 311 | } |
|
| 322 | 312 | ||
| 323 | 313 | let results = join_all(tasks).await; |
|
| 324 | - | ||
| 325 | - | spinner.finish_and_clear(); |
|
| 326 | 314 | ||
| 327 | 315 | let mut balances = Vec::new(); |
|
| 328 | 316 | for result in results { |
|
| 389 | 377 | ) |
|
| 390 | 378 | .get_matches(); |
|
| 391 | 379 | ||
| 380 | + | let spinner = ProgressBar::new_spinner(); |
|
| 381 | + | spinner.set_style( |
|
| 382 | + | ProgressStyle::default_spinner() |
|
| 383 | + | .tick_chars("⠁⠂⠄⡀⢀⠠⠐⠈ ") |
|
| 384 | + | .template("{spinner:.green} {msg}") |
|
| 385 | + | .unwrap() |
|
| 386 | + | ); |
|
| 387 | + | spinner.set_message("Fetching balances..."); |
|
| 388 | + | spinner.enable_steady_tick(std::time::Duration::from_millis(100)); |
|
| 389 | + | ||
| 392 | 390 | let config = read_config()?; |
|
| 393 | 391 | ||
| 394 | 392 | let input = match matches.get_one::<String>("address"){ |
|
| 410 | 408 | ||
| 411 | 409 | let address = resolve_address_or_ens(&input, &networks).await?; |
|
| 412 | 410 | ||
| 411 | + | ||
| 413 | 412 | let balances = fetch_all_balances(&address, networks).await?; |
|
| 413 | + | ||
| 414 | + | spinner.finish_and_clear(); |
|
| 414 | 415 | ||
| 415 | 416 | if balances.is_empty(){ |
|
| 416 | 417 | println!("No balances found for address {}", address); |
|