fix(deps): update rust crate indicatif to 0.17.8 #24

Merged
kemitix merged 2 commits from renovate/indicatif-0.x into main 2024-03-27 10:50:19 +00:00
6 changed files with 55 additions and 27 deletions

45
Cargo.lock generated
View file

@ -258,6 +258,12 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]]
name = "base64"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
[[package]]
name = "bitflags"
version = "1.2.1"
@ -407,15 +413,15 @@ dependencies = [
[[package]]
name = "console"
version = "0.14.1"
version = "0.15.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3993e6445baa160675931ec041a5e03ca84b9c6e32a056150d3aa2bdda0a1f45"
checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb"
dependencies = [
"encode_unicode",
"lazy_static",
"libc",
"terminal_size",
"winapi",
"unicode-width",
"windows-sys 0.52.0",
]
[[package]]
@ -437,7 +443,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951"
dependencies = [
"aes-gcm",
"base64",
"base64 0.13.0",
"hkdf",
"hmac",
"percent-encoding",
@ -1135,7 +1141,7 @@ dependencies = [
"anyhow",
"async-channel",
"async-std",
"base64",
"base64 0.13.0",
"cookie",
"futures-lite",
"infer",
@ -1195,14 +1201,15 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
[[package]]
name = "indicatif"
version = "0.16.2"
version = "0.17.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b"
checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3"
dependencies = [
"console",
"lazy_static",
"instant",
"number_prefix",
"regex",
"portable-atomic",
"unicode-width",
]
[[package]]
@ -1514,7 +1521,7 @@ name = "paperoni"
version = "0.6.1-alpha1"
dependencies = [
"async-std",
"base64",
"base64 0.22.0",
"chrono",
"clap",
"colored",
@ -1690,6 +1697,12 @@ dependencies = [
"universal-hash",
]
[[package]]
name = "portable-atomic"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
[[package]]
name = "powerfmt"
version = "0.2.0"
@ -2291,16 +2304,6 @@ dependencies = [
"utf-8",
]
[[package]]
name = "terminal_size"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86ca8ced750734db02076f44132d802af0b33b09942331f4459dde8636fd2406"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "textwrap"
version = "0.11.0"

View file

@ -26,7 +26,7 @@ eyre = "0.6"
flexi_logger = "0.28.0"
futures = "0.3.30"
html5ever = "0.25.1"
indicatif = "0.16.2"
indicatif = "0.17.8"
itertools = "0.12.1"
kuchiki = "0.8.1"
lazy_static = "1.4.0"

View file

@ -30,7 +30,11 @@ pub fn generate_epubs(
let enabled_bar = ProgressBar::new(articles.len() as u64);
let style = ProgressStyle::default_bar().template(
"{spinner:.cyan} [{elapsed_precise}] {bar:40.white} {:>8} epub {pos}/{len:7} {msg:.green}",
);
).map_err(|e| {
let mut paperoni_err: PaperoniError = e.into();
paperoni_err.set_article_source("progress bar");
vec![paperoni_err]
})?;
enabled_bar.set_style(style);
if !articles.is_empty() {
enabled_bar.set_message("Generating epubs");

View file

@ -15,6 +15,8 @@ pub enum ErrorKind {
UTF8Error(String),
#[error("[ReadabilityError]: {0}")]
ReadabilityError(String),
#[error("[TemplateError]: {0}")]
TemplateError(String),
}
#[derive(Error, Debug)]
@ -128,6 +130,12 @@ impl From<std::str::Utf8Error> for PaperoniError {
}
}
impl From<indicatif::style::TemplateError> for PaperoniError {
fn from(err: indicatif::style::TemplateError) -> Self {
PaperoniError::with_kind(ErrorKind::TemplateError(err.to_string()))
}
}
#[derive(Debug, Error)]
pub enum LogError {
#[error(transparent)]

View file

@ -44,7 +44,11 @@ pub fn generate_html_exports(
let enabled_bar = ProgressBar::new(articles.len() as u64);
let style = ProgressStyle::default_bar().template(
"{spinner:.cyan} [{elapsed_precise}] {bar:40.white} {:>8} html {pos}/{len:7} {msg:.green}",
);
).map_err(|e| {
let mut paperoni_err: PaperoniError = e.into();
paperoni_err.set_article_source("progress bar");
vec![paperoni_err]
})?;
enabled_bar.set_style(style);
if !articles.is_empty() {
enabled_bar.set_message("Generating html files");

View file

@ -2,6 +2,7 @@
extern crate lazy_static;
use std::process::exit;
use std::time::Duration;
use colored::Colorize;
use comfy_table::presets::{UTF8_FULL, UTF8_HORIZONTAL_ONLY};
@ -25,6 +26,8 @@ use epub::generate_epubs;
use html::generate_html_exports;
use logs::display_summary;
use crate::errors::PaperoniError;
fn main() {
let app_config = match cli::AppConfig::init_with_cli() {
Ok(app_config) => app_config,
@ -58,9 +61,15 @@ fn run(app_config: AppConfig) {
let enabled_bar = ProgressBar::new(app_config.urls.len() as u64);
let style = ProgressStyle::default_bar().template(
"{spinner:.cyan} [{elapsed_precise}] {bar:40.white} {:>8} link {pos}/{len:7} {msg:.yellow/white}",
);
).map_err(|e| {
let mut paperoni_err: PaperoniError = e.into();
paperoni_err.set_article_source("progress bar");
vec![paperoni_err]
});
if let Ok(style) = style {
enabled_bar.set_style(style);
enabled_bar.enable_steady_tick(500);
}
enabled_bar.enable_steady_tick(Duration::from_millis(500));
enabled_bar
};