$ show stanislav-tkach/os_info
`os_info` is a Rust workspace containing a library and a small CLI for detecting the host operating system's type, version, edition, codename, bitness, and processor architecture. The public entry point is `os_info::get()`, which dispatches through `cfg`-selected platform modules (`imp::current_platform`) for AIX, Android, Cygwin, DragonFly, Emscripten, FreeBSD, Hurd, illumos, iOS, Linux, macOS, NetBSD, OpenBSD, Redox, Windows, and unknown targets. Linux detection tries `lsb_release` output first, then scans release files through a table-driven parser; macOS reads `SystemVersion.plist` via Objective-C bindings and falls back to `sw_vers`; Windows uses the registry and dynamically loaded `RtlGetVersion`; the BSDs and other Unix-likes rely on `uname` plus platform commands like `sysctl`, `isainfo`, or `prtconf`. The CLI binary wraps this with clap flags for full or partial output. Architecturally, the workspace is clean: platform details are isolated behind a single `current_platform()` function, shared utilities (`matcher`, `uname`, `version`) are small and testable, and public types are documented with optional serde and JSON-schema support. The crate is unusually well tested for its domain: each platform module has unit tests, Linux detection is backed by a corpus of real `/etc/os-release` fixtures for dozens of distributions, and CI enforces formatting, clippy, dead links, spellcheck, dependency licensing, semver checks, and coverage. Unsafe code is denied at the crate level and confined to deliberate FFI modules. Overall, this is a mature, actively maintained system utility rather than an application service or data pipeline. It does not expose endpoints or store data; its value is as a reusable dependency and reference implementation for reliable cross-platform OS introspection.
The LLM identified 2 files worth highlighting for reuse:
Self-contained enum of string matching strategies (`AllTrimmed`, `PrefixedWord`, `PrefixedVersion`, `KeyValue`) used to extract fields from Linux release files and `lsb_release`/`sw_vers` output. It has no internal crate dependencies, only `std`, and is covered by edge-case unit tests. This is a clean, reusable text-parsing building block.
Small Unix utility that reads kernel identity fields via the `nix` `uname()` syscall and transparently falls back to invoking the `uname` command when the syscall is unavailable or the requested field (e.g. `OperatingSystem`) is not exposed by the syscall. Encapsulates field-to-argument mapping, error logging, and output trimming. Only depends on `nix` and `log`, so it can be lifted into another Rust project.