diff --git a/srcpkgs/prose/patches/clap.patch b/srcpkgs/prose/patches/clap.patch new file mode 100644 index 00000000000..4f1d495a62b --- /dev/null +++ b/srcpkgs/prose/patches/clap.patch @@ -0,0 +1,56 @@ +From 037bf5b8e14fc0b8b25e00e2e076515148860825 Mon Sep 17 00:00:00 2001 +From: Joshua Davey +Date: Sat, 10 Dec 2022 16:28:29 -0500 +Subject: [PATCH] Use usize parser from clap + +--- + src/main.rs | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/src/main.rs b/src/main.rs +index efb0420..fb0e8ad 100644 +--- a/src/main.rs ++++ b/src/main.rs +@@ -29,16 +29,14 @@ fn process_paragraphs(io: &mut R, opts: FormatOpts) -> io:: + + fn matches_to_format_opts(matches: &clap::ArgMatches) -> FormatOpts { + let width: usize = matches +- .get_one::<&str>("width") +- .unwrap() +- .parse() ++ .get_one::("width") ++ .cloned() + .expect("Choose a positive number for width"); + let last_line = matches.get_flag("last line"); + let reduce_jaggedness = matches.get_flag("better fit"); + let tab_width: usize = matches +- .get_one::<&str>("tab width") +- .unwrap() +- .parse() ++ .get_one::("tab width") ++ .cloned() + .expect("Choose a positive number for tab width"); + let format_mode = if matches.get_flag("markdown") { + FormatMode::Markdown +@@ -71,6 +69,7 @@ fn main() { + .short('w') + .long("width") + .value_name("WIDTH") ++ .value_parser(clap::value_parser!(usize)) + .default_value("72") + .help("Sets the maximum width for a line")) + .arg(Arg::new("last line") +@@ -86,11 +85,13 @@ fn main() { + .arg(Arg::new("tab width") + .short('t') + .long("tab-width") ++ .value_parser(clap::value_parser!(usize)) + .default_value("4") + .help("Number of spaces to expand tab characters to")) + .arg(Arg::new("markdown") + .short('m') + .long("markdown") ++ .conflicts_with("code comments") + .help("Parse as markdown rather than plain text") + .action(ArgAction::SetTrue)) + .arg(Arg::new("FILE") diff --git a/srcpkgs/prose/template b/srcpkgs/prose/template index f4a97da2f5a..5292df719c2 100644 --- a/srcpkgs/prose/template +++ b/srcpkgs/prose/template @@ -1,7 +1,7 @@ # Template file for 'prose' pkgname=prose version=0.4.0 -revision=1 +revision=2 build_style=cargo short_desc="Reformat text pleasantly" maintainer="Leah Neukirchen "