https://github.com/krypt0nn/whatadistro
Rust library to identify your linux distribution :crab:
https://github.com/krypt0nn/whatadistro
linux rust unix
Last synced: about 1 month ago
JSON representation
Rust library to identify your linux distribution :crab:
- Host: GitHub
- URL: https://github.com/krypt0nn/whatadistro
- Owner: krypt0nn
- License: mit
- Created: 2023-05-19T18:13:18.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-19T19:55:21.000Z (about 3 years ago)
- Last Synced: 2025-01-06T06:43:35.985Z (over 1 year ago)
- Topics: linux, rust, unix
- Language: Rust
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🦀 whatadistro
Rust library to identify your linux distribution
## Examples
### Get current distro name
```rust
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.
```rust
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](https://github.com/krypt0nn)
Licensed under [MIT](LICENSE)