Skip to content

Commit

Permalink
Fix output formatting for free
Browse files Browse the repository at this point in the history
The GNU free is using 11 chars wide for number, not 12. This was also
causing a misalignement of the numbers with the title.
  • Loading branch information
claudex committed Mar 8, 2024
1 parent e809c19 commit d2519fd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/uu/free/src/free.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let used = mem_info.total - mem_info.free;

if wide {
println!(" total used free shared buffers cache available");
println!(" total used free shared buffers cache available");
println!(
"Mem: {:12} {:12} {:12} {:12} {:12} {:12} {:12}",
"Mem: {:11} {:11} {:11} {:11} {:11} {:11} {:11}",
mem_info.total,
used,
mem_info.free,
Expand All @@ -94,9 +94,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
mem_info.available
);
} else {
println!(" total used free shared buff/cache available");
println!(" total used free shared buff/cache available");
println!(
"Mem: {:12} {:12} {:12} {:12} {:12} {:12}",
"Mem: {:11} {:11} {:11} {:11} {:11} {:11}",
mem_info.total,
used,
mem_info.free,
Expand All @@ -106,7 +106,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
);
}
println!(
"Swap: {:12} {:12} {:12}",
"Swap: {:11} {:11} {:11}",
mem_info.swap_total, mem_info.swap_used, mem_info.swap_free
);
}
Expand Down

0 comments on commit d2519fd

Please sign in to comment.