diff options
author | Canop <cano.petrole@gmail.com> | 2020-10-16 22:29:24 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-10-16 22:29:24 +0200 |
commit | 6e2f61c7eb57707f98a1b0ef5bd7b36d3ced7df3 (patch) | |
tree | 9282efc2735e5998dc75e6a944eb2b274ed10e0a /src/filesystems/mod.rs | |
parent | 2cdb563d4b1aac23fe64a6ba80d8392b4e44a899 (diff) |
:filesystems opens a list of mounted filesystems
Beware: this version doesn't compile for raspberry
Diffstat (limited to 'src/filesystems/mod.rs')
-rw-r--r-- | src/filesystems/mod.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/filesystems/mod.rs b/src/filesystems/mod.rs new file mode 100644 index 0000000..e522621 --- /dev/null +++ b/src/filesystems/mod.rs @@ -0,0 +1,43 @@ +//! The whole module is only available on linux now + +mod filesystems_state; +mod mount_list; + +pub use { + filesystems_state::FilesystemState, + mount_list::MountList, +}; + +use { + std::sync::Mutex, + crossterm::{ + style::Color, + }, +}; + +lazy_static! { + static ref MOUNTS: Mutex<MountList> = Mutex::new(MountList::new()); +} + +static SHARE_COLORS: &[Color] = &[ + Color::AnsiValue(28), + Color::AnsiValue(29), + Color::AnsiValue(29), + Color::AnsiValue(29), + Color::AnsiValue(29), + Color::AnsiValue(100), + Color::AnsiValue(136), + Color::AnsiValue(172), + Color::AnsiValue(166), + Color::AnsiValue(196), +]; + +pub fn share_color(share: f64) -> Color { + debug_assert!(share>=0.0 && share <=1.0); + let idx = (share * SHARE_COLORS.len() as f64) as usize; + if idx >= SHARE_COLORS.len() { + SHARE_COLORS[SHARE_COLORS.len()-1] + } else { + SHARE_COLORS[idx] + } +} |