1 unstable release

0.1.0 May 19, 2023

#10 in #identify

Download history 127/week @ 2024-07-19 100/week @ 2024-07-26 122/week @ 2024-08-02 92/week @ 2024-08-09 67/week @ 2024-08-16 60/week @ 2024-08-23 178/week @ 2024-08-30 131/week @ 2024-09-06 108/week @ 2024-09-13 124/week @ 2024-09-20 97/week @ 2024-09-27 147/week @ 2024-10-04 131/week @ 2024-10-11 114/week @ 2024-10-18 112/week @ 2024-10-25 117/week @ 2024-11-01

500 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