#linux-distro #identify #distribution #failed #expect #parse #file

whatadistro

Rust library to identify your linux distribution

1 unstable release

0.1.0 May 19, 2023

#13 in #failed

Download history 71/week @ 2024-11-15 140/week @ 2024-11-22 128/week @ 2024-11-29 124/week @ 2024-12-06 125/week @ 2024-12-13 94/week @ 2024-12-20 71/week @ 2024-12-27 107/week @ 2025-01-03 153/week @ 2025-01-10 137/week @ 2025-01-17 116/week @ 2025-01-24 105/week @ 2025-01-31 179/week @ 2025-02-07 109/week @ 2025-02-14 138/week @ 2025-02-21 152/week @ 2025-02-28

599 downloads per month
Used in pacmanager

MIT license

9KB
164 lines

🦀 whatadistro

Rust library to identify your linux distribution

Examples

Get current distro name

let distro = whatadistro::identify()
    .expect("Failed to parse os-release file");

println!("Your distro name is {}", distro.name());

Compare current distro with some another

Can be used in an app to display a command to download optional dependency. For example, show apt install git for every debian-based system, which are Linux Mint, Ubuntu, Deepin, etc.

let status = whatadistro::identify()
    .map(|distro| distro.is_similar("arch")) // whatadistro::Distro::Arch can be used as well
    .unwrap_or(false);

println!("Is current system arch-based: {:?}", status);

Author: Nikita Podvirnyy

Licensed under MIT

No runtime deps