mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
Switched 'arch' to use clap instead of getopts
This commit is contained in:
parent
7c51fb4946
commit
8747800697
3 changed files with 13 additions and 7 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1658,6 +1658,7 @@ dependencies = [
|
||||||
name = "uu_arch"
|
name = "uu_arch"
|
||||||
version = "0.0.6"
|
version = "0.0.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"clap",
|
||||||
"platform-info",
|
"platform-info",
|
||||||
"uucore",
|
"uucore",
|
||||||
"uucore_procs",
|
"uucore_procs",
|
||||||
|
@ -2406,6 +2407,7 @@ name = "uu_stat"
|
||||||
version = "0.0.6"
|
version = "0.0.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
|
"libc",
|
||||||
"time",
|
"time",
|
||||||
"uucore",
|
"uucore",
|
||||||
"uucore_procs",
|
"uucore_procs",
|
||||||
|
|
|
@ -16,6 +16,7 @@ path = "src/arch.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
platform-info = "0.1"
|
platform-info = "0.1"
|
||||||
|
clap = "2.33"
|
||||||
uucore = { version=">=0.0.8", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.8", package="uucore", path="../../uucore" }
|
||||||
uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" }
|
uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" }
|
||||||
|
|
||||||
|
|
|
@ -10,17 +10,20 @@
|
||||||
extern crate uucore;
|
extern crate uucore;
|
||||||
|
|
||||||
use platform_info::*;
|
use platform_info::*;
|
||||||
use uucore::InvalidEncodingHandling;
|
|
||||||
|
|
||||||
static SYNTAX: &str = "Display machine architecture";
|
use clap::App;
|
||||||
|
|
||||||
|
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
static ABOUT: &str = "Display machine architecture";
|
||||||
static SUMMARY: &str = "Determine architecture name for current machine.";
|
static SUMMARY: &str = "Determine architecture name for current machine.";
|
||||||
static LONG_HELP: &str = "";
|
|
||||||
|
|
||||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
app!(SYNTAX, SUMMARY, LONG_HELP).parse(
|
App::new(executable!())
|
||||||
args.collect_str(InvalidEncodingHandling::ConvertLossy)
|
.version(VERSION)
|
||||||
.accept_any(),
|
.about(ABOUT)
|
||||||
);
|
.after_help(SUMMARY)
|
||||||
|
.get_matches_from(args);
|
||||||
|
|
||||||
let uts = return_if_err!(1, PlatformInfo::new());
|
let uts = return_if_err!(1, PlatformInfo::new());
|
||||||
println!("{}", uts.machine().trim());
|
println!("{}", uts.machine().trim());
|
||||||
0
|
0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue