1 unstable release

0.1.0 May 19, 2023

#11 in #failed

Download history 63/week @ 2023-12-18 78/week @ 2023-12-25 65/week @ 2024-01-01 49/week @ 2024-01-08 60/week @ 2024-01-15 53/week @ 2024-01-22 58/week @ 2024-01-29 42/week @ 2024-02-05 52/week @ 2024-02-12 82/week @ 2024-02-19 89/week @ 2024-02-26 61/week @ 2024-03-04 80/week @ 2024-03-11 96/week @ 2024-03-18 114/week @ 2024-03-25 111/week @ 2024-04-01

411 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