Support textwrap 0.16.0 accepted/tizen_rust tizen accepted/tizen/rust/20231016.020956
authorDongHun Kwak <dh0128.kwak@samsung.com>
Sun, 17 Sep 2023 23:39:49 +0000 (08:39 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Sun, 17 Sep 2023 23:39:49 +0000 (08:39 +0900)
packaging/rust-clap-v2.spec
packaging/support_textwrap_0.16.0.patch [new file with mode: 0644]

index bc07d1f6259067479b4e4be7bfb5410c721e6812..76d3962493885cffb60e69b8300944ea62cc6733 100644 (file)
@@ -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 (file)
index 0000000..ba669f0
--- /dev/null
@@ -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::<Vec<String>>()
+         .join("\n")
+ }