mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-05 06:33:50 +02:00
prose: backport upstream clap patch.
This commit is contained in:
parent
e896393544
commit
385e85b6e3
2 changed files with 57 additions and 1 deletions
56
srcpkgs/prose/patches/clap.patch
Normal file
56
srcpkgs/prose/patches/clap.patch
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
From 037bf5b8e14fc0b8b25e00e2e076515148860825 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Joshua Davey <josh@joshuadavey.com>
|
||||||
|
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<R: BufRead + ?Sized>(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::<usize>("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::<usize>("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")
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'prose'
|
# Template file for 'prose'
|
||||||
pkgname=prose
|
pkgname=prose
|
||||||
version=0.4.0
|
version=0.4.0
|
||||||
revision=1
|
revision=2
|
||||||
build_style=cargo
|
build_style=cargo
|
||||||
short_desc="Reformat text pleasantly"
|
short_desc="Reformat text pleasantly"
|
||||||
maintainer="Leah Neukirchen <leah@vuxu.org>"
|
maintainer="Leah Neukirchen <leah@vuxu.org>"
|
||||||
|
|
Loading…
Add table
Reference in a new issue