Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Canop committed Jun 29, 2021
2 parents b68b0c1 + 5a3cbc8 commit ab8403e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
11 changes: 2 additions & 9 deletions src/fmt_mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ use {
file_size,
lfs_core::*,
minimad::{OwningTemplateExpander, TextTemplate},
termimad::{
terminal_size,
CompoundStyle,
FmtText,
MadSkin,
ProgressBar,
},
termimad::{terminal_size, CompoundStyle, FmtText, MadSkin, ProgressBar},
};

// those colors are chosen to be "redish" for used, "greenish" for available
Expand Down Expand Up @@ -47,8 +41,7 @@ pub fn print(mounts: &[Mount]) -> Result<()> {
if let Some(stats) = mount.stats.as_ref().filter(|s| s.size() > 0) {
let use_share = stats.use_share();
let pb = ProgressBar::new(use_share as f32, BAR_WIDTH);
sub
.set("size", file_size::fit_4(stats.size()))
sub.set("size", file_size::fit_4(stats.size()))
.set("used", file_size::fit_4(stats.used()))
.set("use-percents", format!("{:.0}%", 100.0 * use_share))
.set("bar", format!("{:<width$}", pb, width = BAR_WIDTH))
Expand Down
2 changes: 1 addition & 1 deletion src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ pub fn output_value(mounts: &[Mount]) -> Value {
"stats": stats,
})
})
.collect()
.collect(),
)
}
8 changes: 2 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ mod json;

use {
argh::FromArgs,
std::{
fs,
os::unix::fs::MetadataExt,
path::PathBuf,
},
std::{cmp::Reverse, fs, os::unix::fs::MetadataExt, path::PathBuf},
};

#[derive(FromArgs)]
Expand Down Expand Up @@ -62,7 +58,7 @@ fn main() -> lfs_core::Result<()> {
println!("no disk was found - try\n lfs -a");
Ok(())
} else {
mounts.sort_by_key(|m| u64::MAX - m.size());
mounts.sort_by_key(|m| Reverse(m.size()));
fmt_mount::print(&mounts)
}
}

0 comments on commit ab8403e

Please sign in to comment.