1 unstable release

0.1.0 May 19, 2023

#1032 in Unix APIs

Download history 105/week @ 2025-04-02 277/week @ 2025-04-09 234/week @ 2025-04-16 175/week @ 2025-04-23 267/week @ 2025-04-30 230/week @ 2025-05-07 174/week @ 2025-05-14 161/week @ 2025-05-21 195/week @ 2025-05-28 193/week @ 2025-06-04 219/week @ 2025-06-11 264/week @ 2025-06-18 229/week @ 2025-06-25 221/week @ 2025-07-02 331/week @ 2025-07-09 309/week @ 2025-07-16

1,119 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