1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

uname: use UResult

This commit is contained in:
Thomas Queiroz 2021-11-16 18:06:57 -03:00
parent 06f3db8c55
commit ed3e6b5201
No known key found for this signature in database
GPG key ID: 229D2DDF7ECA5F8F

View file

@ -10,11 +10,9 @@
// spell-checker:ignore (ToDO) nodename kernelname kernelrelease kernelversion sysname hwplatform mnrsv
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use platform_info::*;
use uucore::error::{FromIo, UResult};
const ABOUT: &str = "Print certain system information. With no OPTION, same as -s.";
@ -49,11 +47,13 @@ const HOST_OS: &str = "Fuchsia";
#[cfg(target_os = "redox")]
const HOST_OS: &str = "Redox";
pub fn uumain(args: impl uucore::Args) -> i32 {
#[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = format!("{} [OPTION]...", uucore::execution_phrase());
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
let uname = crash_if_err!(1, PlatformInfo::new());
let uname =
PlatformInfo::new().map_err_context(|| "failed to create PlatformInfo".to_string())?;
let mut output = String::new();
let all = matches.is_present(options::ALL);
@ -115,7 +115,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
}
println!("{}", output.trim_end());
0
Ok(())
}
pub fn uu_app() -> App<'static, 'static> {