Trebejo.OS (Trebejo v2.0.0)

Copy Markdown View Source

Operating system information utilities (shell-based).

Provides shell-dependent system metadata queries: architecture, kernel version, CPU count, memory, and root check. For pure OS detection (type, hostname, distro, WSL, container) use Apero.OS directly.

All command execution is routed through Arrea.Command.execute/2 with validate: false.

Summary

Functions

Returns the CPU architecture of the current machine.

Returns the number of logical CPU cores available to the OS.

Returns a consolidated map of system information.

Returns the OS kernel version string, or "unknown" if unavailable.

Returns true if the current process is running as root / Administrator.

Returns the total system RAM in megabytes, or 0 if unavailable.

Types

arch()

@type arch() :: :x86_64 | :arm64 | :arm | :i386 | :unknown

os_type()

@type os_type() :: :linux | :macos | :windows | :unknown

Functions

arch()

@spec arch() :: arch()

Returns the CPU architecture of the current machine.

Possible values: :x86_64, :arm64, :arm, :i386, :unknown.

cpu_count()

@spec cpu_count() :: pos_integer()

Returns the number of logical CPU cores available to the OS.

info()

@spec info() :: map()

Returns a consolidated map of system information.

For pure-Elixir fields (type, hostname, distro) call Apero.OS directly. Keys: :arch, :kernel_version, :cpu_count, :total_memory_mb.

kernel_version()

@spec kernel_version() :: binary()

Returns the OS kernel version string, or "unknown" if unavailable.

root?()

@spec root?() :: boolean()

Returns true if the current process is running as root / Administrator.

total_memory_mb()

@spec total_memory_mb() :: non_neg_integer()

Returns the total system RAM in megabytes, or 0 if unavailable.