diff options
Diffstat (limited to 'src/lib/list.rs')
| -rw-r--r-- | src/lib/list.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/list.rs b/src/lib/list.rs index 69da792..cb26c19 100644 --- a/src/lib/list.rs +++ b/src/lib/list.rs | |||
| @@ -11,7 +11,6 @@ use std::{ | |||
| 11 | 11 | ||
| 12 | use anyhow::{Result, anyhow}; | 12 | use anyhow::{Result, anyhow}; |
| 13 | use auth_git2::GitAuthenticator; | 13 | use auth_git2::GitAuthenticator; |
| 14 | use console::Style; | ||
| 15 | use futures::stream::{self, StreamExt}; | 14 | use futures::stream::{self, StreamExt}; |
| 16 | use indicatif::{MultiProgress, ProgressBar, ProgressState, ProgressStyle}; | 15 | use indicatif::{MultiProgress, ProgressBar, ProgressState, ProgressStyle}; |
| 17 | use nostr::hashes::sha1::Hash as Sha1Hash; | 16 | use nostr::hashes::sha1::Hash as Sha1Hash; |
| @@ -140,9 +139,8 @@ pub async fn list_from_remotes( | |||
| 140 | let current_timeout_clone = current_timeout.clone(); | 139 | let current_timeout_clone = current_timeout.clone(); |
| 141 | let progress_reporter_clone = progress_reporter.clone(); | 140 | let progress_reporter_clone = progress_reporter.clone(); |
| 142 | let decoded_nostr_url = decoded_nostr_url.clone(); | 141 | let decoded_nostr_url = decoded_nostr_url.clone(); |
| 143 | 142 | ||
| 144 | async move { | 143 | async move { |
| 145 | let dim = Style::new().color256(247); | ||
| 146 | let server_name = get_short_git_server_name(&url); | 144 | let server_name = get_short_git_server_name(&url); |
| 147 | 145 | ||
| 148 | let pb = if std::env::var("NGITTEST").is_err() { | 146 | let pb = if std::env::var("NGITTEST").is_err() { |
| @@ -151,10 +149,12 @@ pub async fn list_from_remotes( | |||
| 151 | let pb = progress_reporter_clone.add( | 149 | let pb = progress_reporter_clone.add( |
| 152 | ProgressBar::new(1) | 150 | ProgressBar::new(1) |
| 153 | .with_prefix( | 151 | .with_prefix( |
| 154 | dim.apply_to(format!( | 152 | console::style(format!( |
| 155 | "{: <server_column_width$} connecting", | 153 | "{: <server_column_width$} connecting", |
| 156 | &server_name | 154 | &server_name |
| 157 | )) | 155 | )) |
| 156 | .for_stderr() | ||
| 157 | .yellow() | ||
| 158 | .to_string(), | 158 | .to_string(), |
| 159 | ) | 159 | ) |
| 160 | .with_style(style), | 160 | .with_style(style), |
| @@ -177,9 +177,9 @@ pub async fn list_from_remotes( | |||
| 177 | if let Some(pb) = pb { | 177 | if let Some(pb) = pb { |
| 178 | pb.set_style(git_server_pb_after_style(false)); | 178 | pb.set_style(git_server_pb_after_style(false)); |
| 179 | pb.set_prefix( | 179 | pb.set_prefix( |
| 180 | Style::new() | 180 | console::style(format!("{: <server_column_width$}", server_name)) |
| 181 | .color256(247) | 181 | .for_stderr() |
| 182 | .apply_to(format!("{: <server_column_width$}", server_name)) | 182 | .dim() |
| 183 | .to_string(), | 183 | .to_string(), |
| 184 | ); | 184 | ); |
| 185 | pb.finish_with_message( | 185 | pb.finish_with_message( |
| @@ -196,7 +196,7 @@ pub async fn list_from_remotes( | |||
| 196 | let url_clone = url.clone(); | 196 | let url_clone = url.clone(); |
| 197 | let decoded_nostr_url_clone = decoded_nostr_url.clone(); | 197 | let decoded_nostr_url_clone = decoded_nostr_url.clone(); |
| 198 | let pb_clone = pb.clone(); | 198 | let pb_clone = pb.clone(); |
| 199 | 199 | ||
| 200 | let list_future = async move { | 200 | let list_future = async move { |
| 201 | match tokio::task::spawn_blocking(move || { | 201 | match tokio::task::spawn_blocking(move || { |
| 202 | // Re-open repo in blocking thread (git2::Repository is not Send) | 202 | // Re-open repo in blocking thread (git2::Repository is not Send) |
| @@ -204,7 +204,7 @@ pub async fn list_from_remotes( | |||
| 204 | Some(path) => Repo::from_path(&path).ok(), | 204 | Some(path) => Repo::from_path(&path).ok(), |
| 205 | None => None, | 205 | None => None, |
| 206 | }; | 206 | }; |
| 207 | 207 | ||
| 208 | match git_repo { | 208 | match git_repo { |
| 209 | Some(ref repo) => list_from_remote_sync( | 209 | Some(ref repo) => list_from_remote_sync( |
| 210 | repo, | 210 | repo, |
| @@ -283,7 +283,7 @@ pub async fn list_from_remotes( | |||
| 283 | temp_states.insert(url.clone(), (state.clone(), is_grasp_server)); | 283 | temp_states.insert(url.clone(), (state.clone(), is_grasp_server)); |
| 284 | let remote_issues = identify_remote_sync_issues(git_repo, nostr_state, &temp_states); | 284 | let remote_issues = identify_remote_sync_issues(git_repo, nostr_state, &temp_states); |
| 285 | let warnings = generate_remote_sync_warnings(&remote_issues, &temp_states); | 285 | let warnings = generate_remote_sync_warnings(&remote_issues, &temp_states); |
| 286 | 286 | ||
| 287 | if warnings.is_empty() { | 287 | if warnings.is_empty() { |
| 288 | "in sync".to_string() | 288 | "in sync".to_string() |
| 289 | } else { | 289 | } else { |
| @@ -313,9 +313,9 @@ pub async fn list_from_remotes( | |||
| 313 | if let Some(pb) = pb { | 313 | if let Some(pb) = pb { |
| 314 | pb.set_style(git_server_pb_after_style(is_success)); | 314 | pb.set_style(git_server_pb_after_style(is_success)); |
| 315 | pb.set_prefix( | 315 | pb.set_prefix( |
| 316 | Style::new() | 316 | console::style(format!("{: <server_column_width$}", &server_name)) |
| 317 | .color256(247) | 317 | .for_stderr() |
| 318 | .apply_to(format!("{: <server_column_width$}", &server_name)) | 318 | .dim() |
| 319 | .to_string(), | 319 | .to_string(), |
| 320 | ); | 320 | ); |
| 321 | pb.finish_with_message(message_style.to_string()); | 321 | pb.finish_with_message(message_style.to_string()); |