os_info_cli

Crates.ioos_info_cli
lib.rsos_info_cli
version2.0.0
sourcesrc
created_at2020-05-09 21:44:25.132078
updated_at2022-02-04 13:02:58.49073
descriptionDetect the operating system type and version.
homepagehttps://github.com/stanislav-tkach/os_info
repositoryhttps://github.com/stanislav-tkach/os_info
max_upload_size
id239409
size21,512
Stanislav Tkach (stanislav-tkach)

documentation

https://docs.rs/os_info

README

os_info

Status: CI Coverage Dependency status

Project info: Docs.rs Latest version License

Project details: LoC Rust 1.41+ required

Overview

This project consists of two parts: the library that can be used to detect the operating system type (including version and bitness) and the command line tool that uses the library.

Library (os_info)

os_info usage

To use this crate, add os_info as a dependency to your project's Cargo.toml:

[dependencies]
os_info = "3"

This project has serde as an optional dependency, so if you don't need it, then you can speed up compilation disabling it:

[dependencies]
os_info = { version = "3", default-features = false }

Example

let info = os_info::get();

// Print full information:
println!("OS information: {}", info);

// Print information separately:
println!("Type: {}", info.os_type());
println!("Version: {}", info.version());
println!("Bitness: {}", info.bitness());

Command line tool (os_info_cli)

A simple wrapper around the os_info library.

Installation

This tool can be installed using the following cargo command:

cargo install os_info_cli

os_info_cli usage

Despite being named os_info_cli during installation, it is actually named os_info. You can use the --help flag to see available options:

os_info --help

Supported operating systems

Right now, the following operating system types can be returned:

  • Alpine Linux
  • Amazon Linux AMI
  • Android
  • Arch Linux
  • CentOS
  • Debian
  • DragonFly BSD
  • Emscripten
  • EndeavourOS
  • Fedora
  • FreeBSD
  • Linux
  • Linux Mint
  • macOS (Mac OS X or OS X)
  • Manjaro
  • MidnightBSD
  • NetBSD
  • NixOS
  • OpenBSD
  • openSUSE
  • Oracle Linux
  • Pop!_OS
  • Raspberry OS
  • Red Hat Linux
  • Red Hat Enterprise Linux
  • Redox
  • Solus
  • SUSE Linux Enterprise Server
  • Ubuntu
  • Unknown
  • Windows

If you need support for more OS types, I am looking forward to your Pull Request.

License

os_info is licensed under the MIT license. See LICENSE for the details.

Commit count: 792

cargo fmt