From afcce58d6d1cd866cf208bdfa72b4e7af9ba3493 Mon Sep 17 00:00:00 2001 From: renovate Date: Wed, 27 Mar 2024 10:50:18 +0000 Subject: [PATCH] fix(deps): update rust crate indicatif to 0.17.8 (#24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [indicatif](https://github.com/console-rs/indicatif) | dependencies | minor | `0.16.2` -> `0.17.8` | > :exclamation: **Important** > > Release Notes retrieval for this PR were skipped because no github.com credentials were available. > If you are self-hosted, please see [this instruction](https://github.com/renovatebot/renovate/blob/master/docs/usage/examples/self-hosting.md#githubcom-token-for-release-notes). --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Co-authored-by: Renovate Bot Co-authored-by: Paul Campbell Reviewed-on: https://git.kemitix.net/kemitix/paperoni/pulls/24 Co-authored-by: renovate Co-committed-by: renovate --- Cargo.lock | 45 ++++++++++++++++++++++++--------------------- Cargo.toml | 2 +- src/epub.rs | 6 +++++- src/errors.rs | 8 ++++++++ src/html.rs | 6 +++++- src/main.rs | 15 ++++++++++++--- 6 files changed, 55 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 150d061..b843588 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml index 4729092..a3aa4a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/epub.rs b/src/epub.rs index 14239a3..20713a8 100644 --- a/src/epub.rs +++ b/src/epub.rs @@ -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"); diff --git a/src/errors.rs b/src/errors.rs index 7df872a..02be430 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -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 for PaperoniError { } } +impl From 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)] diff --git a/src/html.rs b/src/html.rs index 07ad767..44eecd9 100644 --- a/src/html.rs +++ b/src/html.rs @@ -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"); diff --git a/src/main.rs b/src/main.rs index fa49ab0..56a8809 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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}", - ); - enabled_bar.set_style(style); - enabled_bar.enable_steady_tick(500); + ).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(Duration::from_millis(500)); enabled_bar };