m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-17 09:33:38 -05:00

Nearly complete versioning support. Fixed old bugs where not all tags were fetched.

This commit is contained in:
Sergio
2024-11-15 13:21:30 +02:00
parent c11b5e6432
commit d94abecf35
30 changed files with 1288 additions and 962 deletions

31
src/formatting/spinner.rs Normal file
View File

@@ -0,0 +1,31 @@
use std::time::Duration;
use indicatif::{ProgressBar, ProgressStyle};
pub struct Spinner {
spinner: ProgressBar,
}
impl Spinner {
#[allow(clippy::new_without_default)]
pub fn new() -> Spinner {
let spinner = ProgressBar::new_spinner();
let style: &[&str] = &["", "", "", "", "", "", "", "", "", ""];
let progress_style = ProgressStyle::default_spinner();
spinner.set_style(ProgressStyle::tick_strings(progress_style, style));
spinner.set_message("Checking...");
spinner.enable_steady_tick(Duration::from_millis(50));
Spinner { spinner }
}
pub fn succeed(&self) {
const CHECKMARK: &str = "\u{001b}[32;1m\u{2713}\u{001b}[0m";
let success_message = format!("{} Done!", CHECKMARK);
self.spinner
.set_style(ProgressStyle::with_template("{msg}").unwrap());
self.spinner.finish_with_message(success_message);
}
}