MCPcopy Index your code
hub / github.com/Macchina-CLI/libmacchina

github.com/Macchina-CLI/libmacchina @v8.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v8.1.0 ↗ · + Follow
475 symbols 725 edges 20 files 47 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

libmacchina

A library providing access to all sorts of system information.

Linux • macOS • Windows • NetBSD • FreeBSD • Android • OpenWrt

version

docs

Disclaimer

libmacchina utilizes unsafe code in the form of calls to system libraries that haven't been natively implemented in Rust, we do this for performance reasons.

Usage

Add the following to your project's Cargo.toml file:

libmacchina = "7"

Notes

On distributions like openSUSE that use the ndb RPM database format, librpm (which is usually provided by the rpm-devel package) is required for the RPM package count readout to work.

Examples

// Let's import two of the several available types.
use libmacchina::{GeneralReadout, MemoryReadout};

fn main() {
    // Let's import the GeneralReadout trait so we
    // can fetch some general information about the host.
    use libmacchina::traits::GeneralReadout as _;

    let general_readout = GeneralReadout::new();

    // There are many more metrics we can query
    // i.e. username, distribution, terminal, shell, etc.
    let cpu_cores = general_readout.cpu_cores().unwrap(); // 8 [logical cores]
    let cpu = general_readout.cpu_model_name().unwrap();  // Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
    let uptime = general_readout.uptime().unwrap();       // 1500 [in seconds]

    // Now we'll import the MemoryReadout trait to get an
    // idea of what the host's memory usage looks like.
    use libmacchina::traits::MemoryReadout as _;

    let memory_readout = MemoryReadout::new();

    let total_mem = memory_readout.total(); // 20242204 [in kB]
    let used_mem = memory_readout.used();   // 3894880 [in kB]
}

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 364
Class 57
Function 41
Interface 7
Enum 6

Languages

Rust100%

Modules by API surface

src/linux/mod.rs66 symbols
src/macos/mod.rs61 symbols
src/windows/mod.rs60 symbols
src/freebsd/mod.rs57 symbols
src/netbsd/mod.rs56 symbols
src/android/mod.rs55 symbols
src/openwrt/mod.rs49 symbols
src/shared/mod.rs17 symbols
src/traits.rs16 symbols
src/extra.rs11 symbols
src/linux/pci_devices.rs9 symbols
src/dirs.rs3 symbols

For agents

$ claude mcp add libmacchina \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page