mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:06:08 +02:00
Make $nu constant (#10160)
This commit is contained in:
@ -3,6 +3,7 @@ mod foreground;
|
||||
mod linux;
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macos;
|
||||
pub mod os_info;
|
||||
#[cfg(target_os = "windows")]
|
||||
mod windows;
|
||||
|
||||
|
21
crates/nu-system/src/os_info.rs
Normal file
21
crates/nu-system/src/os_info.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use sysinfo::SystemExt;
|
||||
|
||||
pub fn get_os_name() -> &'static str {
|
||||
std::env::consts::OS
|
||||
}
|
||||
|
||||
pub fn get_os_arch() -> &'static str {
|
||||
std::env::consts::ARCH
|
||||
}
|
||||
|
||||
pub fn get_os_family() -> &'static str {
|
||||
std::env::consts::FAMILY
|
||||
}
|
||||
|
||||
pub fn get_kernel_version() -> String {
|
||||
let sys = sysinfo::System::new();
|
||||
match sys.kernel_version() {
|
||||
Some(v) => v,
|
||||
None => "unknown".to_string(),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user