Skip to content

Commit 85a0f26

Browse files
committed
Append disk path to disk readout value
1 parent b300578 commit 85a0f26

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/data/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ fn handle_readout_disk_space(
533533
} else {
534534
readout_values.push(Readout::new(
535535
ReadoutKey::DiskSpace,
536-
format_disk_space(used, total, opt.disk_space_percentage),
536+
format_disk_space(disk_path, used, total, opt.disk_space_percentage),
537537
))
538538
}
539539
}

src/format.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use bytesize::ByteSize;
22
use libmacchina::traits::{BatteryState, PackageManager, ReadoutError};
3+
use std::path::PathBuf;
34

45
/// This function should return a new `String` constructed from the value \
56
/// returned by `traits::GeneralReadout::uptime()`
@@ -140,12 +141,13 @@ pub fn packages(packages: Vec<(PackageManager, usize)>) -> Result<String, Readou
140141
Ok(string)
141142
}
142143

143-
pub fn disk_space(used: u64, total: u64, percentage: bool) -> String {
144+
pub fn disk_space(path: PathBuf, used: u64, total: u64, percentage: bool) -> String {
144145
let used_kb = ByteSize::b(used);
145146
let total_kb = ByteSize::b(total);
147+
let path = path.display();
146148

147149
let mut output = String::new();
148-
output.push_str(&format!("{used_kb} / {total_kb}"));
150+
output.push_str(&format!("{used_kb} / {total_kb} ({path})"));
149151

150152
if percentage {
151153
let p = (used as f64 / total as f64 * 100f64).ceil() as usize;

0 commit comments

Comments
 (0)