From 6e3f4577b1079ebe62979f5b9c61ecdc00869d13 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 18 Sep 2023 08:39:49 +0900 Subject: [PATCH] Support textwrap 0.16.0 --- packaging/rust-clap-v2.spec | 2 ++ packaging/support_textwrap_0.16.0.patch | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 packaging/support_textwrap_0.16.0.patch diff --git a/packaging/rust-clap-v2.spec b/packaging/rust-clap-v2.spec index bc07d1f..76d3962 100644 --- a/packaging/rust-clap-v2.spec +++ b/packaging/rust-clap-v2.spec @@ -15,6 +15,7 @@ License: MIT URL: https://crates.io/crates/clap Source: %{crate}-%{version}.tar.gz Source1: %{name}.manifest +Source2: support_textwrap_0.16.0.patch # ========================================================== # BuildRequires @@ -50,6 +51,7 @@ Simple to use, efficient, and full-featured Command Line Argument Parser. %prep %setup -q cp %{SOURCE1} . +%{__patch} -p1 < %{SOURCE2} # ========================================================== # build section diff --git a/packaging/support_textwrap_0.16.0.patch b/packaging/support_textwrap_0.16.0.patch new file mode 100644 index 0000000..ba669f0 --- /dev/null +++ b/packaging/support_textwrap_0.16.0.patch @@ -0,0 +1,24 @@ +diff --git a/src/app/help.rs b/src/app/help.rs +index e5f2a60..330d9a2 100644 +--- a/src/app/help.rs ++++ b/src/app/help.rs +@@ -13,6 +13,7 @@ use std::{ + use term_size; + #[cfg(feature = "wrap_help")] + use textwrap; ++use textwrap::fill; + use unicode_width::UnicodeWidthStr; + + // Internal +@@ -1013,9 +1014,9 @@ impl<'a> Help<'a> { + } + + fn wrap_help(help: &str, avail_chars: usize) -> String { +- let wrapper = textwrap::Wrapper::new(avail_chars).break_words(false); ++ let wrapper = textwrap::Options::new(avail_chars).break_words(false); + help.lines() +- .map(|line| wrapper.fill(line)) ++ .map(|line| fill(line, &wrapper)) + .collect::>() + .join("\n") + } -- 2.34.1