fix: output a blank line between items

This commit is contained in:
Farid Huliiev 2025-04-30 19:56:31 +02:00
parent 185c695261
commit 49e2f84edd
No known key found for this signature in database
GPG Key ID: FC035A43354326A5
6 changed files with 53 additions and 29 deletions

View File

@ -159,19 +159,19 @@ pub fn add(workspace: &Workspace<'_>, options: &AddOptions<'_>) -> CargoResult<(
activated.retain(|f| !unknown_features.contains(f)); activated.retain(|f| !unknown_features.contains(f));
let mut message = format!( let mut message = format!(
"unrecognized feature{} for crate {}: {}\n", "unrecognized feature{} for crate {}: {}",
if unknown_features.len() == 1 { "" } else { "s" }, if unknown_features.len() == 1 { "" } else { "s" },
dep.name, dep.name,
unknown_features.iter().format(", "), unknown_features.iter().format(", "),
); );
if activated.is_empty() && deactivated.is_empty() { if activated.is_empty() && deactivated.is_empty() {
write!(message, "no features available for crate {}", dep.name)?; write!(message, "\n\nno features available for crate {}", dep.name)?;
} else { } else {
if !deactivated.is_empty() { if !deactivated.is_empty() {
if deactivated.len() <= MAX_FEATURE_PRINTS { if deactivated.len() <= MAX_FEATURE_PRINTS {
writeln!( write!(
message, message,
"disabled features:\n {}", "\n\ndisabled features:\n {}",
deactivated deactivated
.iter() .iter()
.map(|s| s.to_string()) .map(|s| s.to_string())
@ -184,14 +184,18 @@ pub fn add(workspace: &Workspace<'_>, options: &AddOptions<'_>) -> CargoResult<(
.format("\n ") .format("\n ")
)?; )?;
} else { } else {
writeln!(message, "{} disabled features available", deactivated.len())?; write!(
message,
"\n\n{} disabled features available",
deactivated.len()
)?;
} }
} }
if !activated.is_empty() { if !activated.is_empty() {
if deactivated.len() + activated.len() <= MAX_FEATURE_PRINTS { if deactivated.len() + activated.len() <= MAX_FEATURE_PRINTS {
writeln!( writeln!(
message, message,
"enabled features:\n {}", "\n\nenabled features:\n {}",
activated activated
.iter() .iter()
.map(|s| s.to_string()) .map(|s| s.to_string())
@ -204,7 +208,11 @@ pub fn add(workspace: &Workspace<'_>, options: &AddOptions<'_>) -> CargoResult<(
.format("\n ") .format("\n ")
)?; )?;
} else { } else {
writeln!(message, "{} enabled features available", activated.len())?; writeln!(
message,
"\n\n{} enabled features available",
activated.len()
)?;
} }
} }
} }

View File

@ -1,4 +1,4 @@
<svg width="740px" height="164px" xmlns="http://www.w3.org/2000/svg"> <svg width="740px" height="200px" xmlns="http://www.w3.org/2000/svg">
<style> <style>
.fg { fill: #AAAAAA } .fg { fill: #AAAAAA }
.bg { background: #000000 } .bg { background: #000000 }
@ -25,15 +25,19 @@
</tspan> </tspan>
<tspan x="10px" y="64px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized features for crate your-face: eees100, eees101</tspan> <tspan x="10px" y="64px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized features for crate your-face: eees100, eees101</tspan>
</tspan> </tspan>
<tspan x="10px" y="82px"><tspan>disabled features:</tspan> <tspan x="10px" y="82px">
</tspan> </tspan>
<tspan x="10px" y="100px"><tspan> eyes040, eyes041, eyes042, eyes043, eyes044, eyes045, eyes046, eyes047, eyes048</tspan> <tspan x="10px" y="100px"><tspan>disabled features:</tspan>
</tspan> </tspan>
<tspan x="10px" y="118px"><tspan> eyes049</tspan> <tspan x="10px" y="118px"><tspan> eyes040, eyes041, eyes042, eyes043, eyes044, eyes045, eyes046, eyes047, eyes048</tspan>
</tspan> </tspan>
<tspan x="10px" y="136px"><tspan>40 enabled features available</tspan> <tspan x="10px" y="136px"><tspan> eyes049</tspan>
</tspan> </tspan>
<tspan x="10px" y="154px"> <tspan x="10px" y="154px">
</tspan>
<tspan x="10px" y="172px"><tspan>40 enabled features available</tspan>
</tspan>
<tspan x="10px" y="190px">
</tspan> </tspan>
</text> </text>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,4 +1,4 @@
<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg"> <svg width="740px" height="164px" xmlns="http://www.w3.org/2000/svg">
<style> <style>
.fg { fill: #AAAAAA } .fg { fill: #AAAAAA }
.bg { background: #000000 } .bg { background: #000000 }
@ -25,11 +25,15 @@
</tspan> </tspan>
<tspan x="10px" y="64px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized features for crate your-face: eees100, eees101</tspan> <tspan x="10px" y="64px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized features for crate your-face: eees100, eees101</tspan>
</tspan> </tspan>
<tspan x="10px" y="82px"><tspan>199 disabled features available</tspan> <tspan x="10px" y="82px">
</tspan> </tspan>
<tspan x="10px" y="100px"><tspan>1 enabled features available</tspan> <tspan x="10px" y="100px"><tspan>199 disabled features available</tspan>
</tspan> </tspan>
<tspan x="10px" y="118px"> <tspan x="10px" y="118px">
</tspan>
<tspan x="10px" y="136px"><tspan>1 enabled features available</tspan>
</tspan>
<tspan x="10px" y="154px">
</tspan> </tspan>
</text> </text>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,4 +1,4 @@
<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg"> <svg width="740px" height="146px" xmlns="http://www.w3.org/2000/svg">
<style> <style>
.fg { fill: #AAAAAA } .fg { fill: #AAAAAA }
.bg { background: #000000 } .bg { background: #000000 }
@ -25,11 +25,13 @@
</tspan> </tspan>
<tspan x="10px" y="64px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized feature for crate your-face: noze</tspan> <tspan x="10px" y="64px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized feature for crate your-face: noze</tspan>
</tspan> </tspan>
<tspan x="10px" y="82px"><tspan>disabled features:</tspan> <tspan x="10px" y="82px">
</tspan> </tspan>
<tspan x="10px" y="100px"><tspan> ears, eyes, mouth, nose</tspan> <tspan x="10px" y="100px"><tspan>disabled features:</tspan>
</tspan> </tspan>
<tspan x="10px" y="118px"> <tspan x="10px" y="118px"><tspan> ears, eyes, mouth, nose</tspan>
</tspan>
<tspan x="10px" y="136px">
</tspan> </tspan>
</text> </text>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,4 +1,4 @@
<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg"> <svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg">
<style> <style>
.fg { fill: #AAAAAA } .fg { fill: #AAAAAA }
.bg { background: #000000 } .bg { background: #000000 }
@ -25,9 +25,11 @@
</tspan> </tspan>
<tspan x="10px" y="64px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized feature for crate my-package: noze</tspan> <tspan x="10px" y="64px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized feature for crate my-package: noze</tspan>
</tspan> </tspan>
<tspan x="10px" y="82px"><tspan>no features available for crate my-package</tspan> <tspan x="10px" y="82px">
</tspan> </tspan>
<tspan x="10px" y="100px"> <tspan x="10px" y="100px"><tspan>no features available for crate my-package</tspan>
</tspan>
<tspan x="10px" y="118px">
</tspan> </tspan>
</text> </text>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,4 +1,4 @@
<svg width="740px" height="164px" xmlns="http://www.w3.org/2000/svg"> <svg width="740px" height="200px" xmlns="http://www.w3.org/2000/svg">
<style> <style>
.fg { fill: #AAAAAA } .fg { fill: #AAAAAA }
.bg { background: #000000 } .bg { background: #000000 }
@ -23,17 +23,21 @@
</tspan> </tspan>
<tspan x="10px" y="46px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized feature for crate foo: not_recognized</tspan> <tspan x="10px" y="46px"><tspan class="fg-red bold">error</tspan><tspan class="bold">:</tspan><tspan> unrecognized feature for crate foo: not_recognized</tspan>
</tspan> </tspan>
<tspan x="10px" y="64px"><tspan>disabled features:</tspan> <tspan x="10px" y="64px">
</tspan> </tspan>
<tspan x="10px" y="82px"><tspan> merge, merge-base, unrelated</tspan> <tspan x="10px" y="82px"><tspan>disabled features:</tspan>
</tspan> </tspan>
<tspan x="10px" y="100px"><tspan>enabled features:</tspan> <tspan x="10px" y="100px"><tspan> merge, merge-base, unrelated</tspan>
</tspan> </tspan>
<tspan x="10px" y="118px"><tspan> default-base, default-merge-base, default-test-base</tspan> <tspan x="10px" y="118px">
</tspan> </tspan>
<tspan x="10px" y="136px"><tspan> long-feature-name-because-of-formatting-reasons, test, test-base</tspan> <tspan x="10px" y="136px"><tspan>enabled features:</tspan>
</tspan> </tspan>
<tspan x="10px" y="154px"> <tspan x="10px" y="154px"><tspan> default-base, default-merge-base, default-test-base</tspan>
</tspan>
<tspan x="10px" y="172px"><tspan> long-feature-name-because-of-formatting-reasons, test, test-base</tspan>
</tspan>
<tspan x="10px" y="190px">
</tspan> </tspan>
</text> </text>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB