Skip to content

Commit 6d214b5

Browse files
committed
fix: fixes a bug when parsing multiple {n} newlines inside help strings
1 parent f2dd2cb commit 6d214b5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "clap"
4-
version = "1.1.1"
4+
version = "1.1.2"
55
authors = ["Kevin K. <[email protected]>"]
66
exclude = ["examples/*", "clap-tests/*"]
77
description = "A simple to use, efficient, and full featured Command Line Argument Parser"

src/macros.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ macro_rules! print_opt_help {
4242
if let Some(h) = $opt.help {
4343
if h.contains("{n}") {
4444
let mut hel = h.split("{n}");
45+
if let Some(part) = hel.next() {
46+
print!("{}", part);
47+
}
4548
while let Some(part) = hel.next() {
46-
print!("{}\n", part);
49+
print!("\n");
4750
$me.print_spaces($spc);
48-
print!("{}", hel.next().unwrap_or(""));
51+
print!("{}", part);
52+
// print!("{}", hel.next().unwrap_or(""));
4953
}
5054
} else {
5155
print!("{}", h);

0 commit comments

Comments
 (0)