Crates.io | whatadistro |
lib.rs | whatadistro |
version | 0.1.0 |
source | src |
created_at | 2023-05-19 19:55:31.331682 |
updated_at | 2023-05-19 19:55:31.331682 |
description | Rust library to identify your linux distribution |
homepage | |
repository | |
max_upload_size | |
id | 869071 |
size | 9,684 |
Rust library to identify your linux distribution
let distro = whatadistro::identify()
.expect("Failed to parse os-release file");
println!("Your distro name is {}", distro.name());
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