mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
refactor/uname ~ use platform_info-v1.0.2
This commit is contained in:
parent
6a9660f9f6
commit
10f35fc282
2 changed files with 2 additions and 23 deletions
|
@ -15,7 +15,7 @@ edition = "2021"
|
||||||
path = "src/uname.rs"
|
path = "src/uname.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
platform-info = "1.0.1"
|
platform-info = "1.0.2"
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
||||||
|
|
||||||
|
|
|
@ -33,27 +33,6 @@ pub mod options {
|
||||||
pub static OS: &str = "operating-system";
|
pub static OS: &str = "operating-system";
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_os = "linux", any(target_env = "gnu", target_env = "")))]
|
|
||||||
const HOST_OS: &str = "GNU/Linux";
|
|
||||||
#[cfg(all(target_os = "linux", not(any(target_env = "gnu", target_env = ""))))]
|
|
||||||
const HOST_OS: &str = "Linux";
|
|
||||||
#[cfg(target_os = "android")]
|
|
||||||
const HOST_OS: &str = "Android";
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
const HOST_OS: &str = "Windows NT";
|
|
||||||
#[cfg(target_os = "freebsd")]
|
|
||||||
const HOST_OS: &str = "FreeBSD";
|
|
||||||
#[cfg(target_os = "netbsd")]
|
|
||||||
const HOST_OS: &str = "NetBSD";
|
|
||||||
#[cfg(target_os = "openbsd")]
|
|
||||||
const HOST_OS: &str = "OpenBSD";
|
|
||||||
#[cfg(target_vendor = "apple")]
|
|
||||||
const HOST_OS: &str = "Darwin";
|
|
||||||
#[cfg(target_os = "fuchsia")]
|
|
||||||
const HOST_OS: &str = "Fuchsia";
|
|
||||||
#[cfg(target_os = "redox")]
|
|
||||||
const HOST_OS: &str = "Redox";
|
|
||||||
|
|
||||||
#[uucore::main]
|
#[uucore::main]
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let matches = uu_app().try_get_matches_from(args)?;
|
let matches = uu_app().try_get_matches_from(args)?;
|
||||||
|
@ -108,7 +87,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if os || all {
|
if os || all {
|
||||||
output.push_str(HOST_OS);
|
output.push_str(&uname.osname());
|
||||||
output.push(' ');
|
output.push(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue