mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
uname: clap 3
This commit is contained in:
parent
48c65934c7
commit
7de993fa4f
2 changed files with 21 additions and 21 deletions
|
@ -15,7 +15,7 @@ edition = "2018"
|
||||||
path = "src/uname.rs"
|
path = "src/uname.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "2.33", features = ["wrap_help"] }
|
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
|
||||||
platform-info = "0.2"
|
platform-info = "0.2"
|
||||||
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
|
||||||
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
||||||
|
|
|
@ -50,7 +50,7 @@ const HOST_OS: &str = "Redox";
|
||||||
#[uucore_procs::gen_uumain]
|
#[uucore_procs::gen_uumain]
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let usage = format!("{} [OPTION]...", uucore::execution_phrase());
|
let usage = format!("{} [OPTION]...", uucore::execution_phrase());
|
||||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
|
||||||
|
|
||||||
let uname =
|
let uname =
|
||||||
PlatformInfo::new().map_err_context(|| "failed to create PlatformInfo".to_string())?;
|
PlatformInfo::new().map_err_context(|| "failed to create PlatformInfo".to_string())?;
|
||||||
|
@ -118,46 +118,46 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app() -> App<'static, 'static> {
|
pub fn uu_app<'a>() -> App<'a> {
|
||||||
App::new(uucore::util_name())
|
App::new(uucore::util_name())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.arg(Arg::with_name(options::ALL)
|
.arg(Arg::new(options::ALL)
|
||||||
.short("a")
|
.short('a')
|
||||||
.long(options::ALL)
|
.long(options::ALL)
|
||||||
.help("Behave as though all of the options -mnrsv were specified."))
|
.help("Behave as though all of the options -mnrsv were specified."))
|
||||||
.arg(Arg::with_name(options::KERNELNAME)
|
.arg(Arg::new(options::KERNELNAME)
|
||||||
.short("s")
|
.short('s')
|
||||||
.long(options::KERNELNAME)
|
.long(options::KERNELNAME)
|
||||||
.alias("sysname") // Obsolescent option in GNU uname
|
.alias("sysname") // Obsolescent option in GNU uname
|
||||||
.help("print the kernel name."))
|
.help("print the kernel name."))
|
||||||
.arg(Arg::with_name(options::NODENAME)
|
.arg(Arg::new(options::NODENAME)
|
||||||
.short("n")
|
.short('n')
|
||||||
.long(options::NODENAME)
|
.long(options::NODENAME)
|
||||||
.help("print the nodename (the nodename may be a name that the system is known by to a communications network)."))
|
.help("print the nodename (the nodename may be a name that the system is known by to a communications network)."))
|
||||||
.arg(Arg::with_name(options::KERNELRELEASE)
|
.arg(Arg::new(options::KERNELRELEASE)
|
||||||
.short("r")
|
.short('r')
|
||||||
.long(options::KERNELRELEASE)
|
.long(options::KERNELRELEASE)
|
||||||
.alias("release") // Obsolescent option in GNU uname
|
.alias("release") // Obsolescent option in GNU uname
|
||||||
.help("print the operating system release."))
|
.help("print the operating system release."))
|
||||||
.arg(Arg::with_name(options::KERNELVERSION)
|
.arg(Arg::new(options::KERNELVERSION)
|
||||||
.short("v")
|
.short('v')
|
||||||
.long(options::KERNELVERSION)
|
.long(options::KERNELVERSION)
|
||||||
.help("print the operating system version."))
|
.help("print the operating system version."))
|
||||||
.arg(Arg::with_name(options::HWPLATFORM)
|
.arg(Arg::new(options::HWPLATFORM)
|
||||||
.short("i")
|
.short('i')
|
||||||
.long(options::HWPLATFORM)
|
.long(options::HWPLATFORM)
|
||||||
.help("print the hardware platform (non-portable)"))
|
.help("print the hardware platform (non-portable)"))
|
||||||
.arg(Arg::with_name(options::MACHINE)
|
.arg(Arg::new(options::MACHINE)
|
||||||
.short("m")
|
.short('m')
|
||||||
.long(options::MACHINE)
|
.long(options::MACHINE)
|
||||||
.help("print the machine hardware name."))
|
.help("print the machine hardware name."))
|
||||||
.arg(Arg::with_name(options::PROCESSOR)
|
.arg(Arg::new(options::PROCESSOR)
|
||||||
.short("p")
|
.short('p')
|
||||||
.long(options::PROCESSOR)
|
.long(options::PROCESSOR)
|
||||||
.help("print the processor type (non-portable)"))
|
.help("print the processor type (non-portable)"))
|
||||||
.arg(Arg::with_name(options::OS)
|
.arg(Arg::new(options::OS)
|
||||||
.short("o")
|
.short('o')
|
||||||
.long(options::OS)
|
.long(options::OS)
|
||||||
.help("print the operating system name."))
|
.help("print the operating system name."))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue