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:
parent
06f3db8c55
commit
ed3e6b5201
1 changed files with 6 additions and 6 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue