1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-31 13:07:46 +00:00

reorder the args

This commit is contained in:
Sylvestre Ledru 2020-10-25 12:27:04 +01:00
parent b72972e0b2
commit 0d4e36d5cd

View file

@ -31,9 +31,9 @@ enum TruncateMode {
static ABOUT: &str = "Shrink or extend the size of each file to the specified size."; static ABOUT: &str = "Shrink or extend the size of each file to the specified size.";
static VERSION: &str = env!("CARGO_PKG_VERSION"); static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_IO_BLOCKS: &str = "io-blocks";
static OPT_NO_CREATE: &str = "no-create"; static OPT_NO_CREATE: &str = "no-create";
static OPT_REFERENCE: &str = "reference"; static OPT_REFERENCE: &str = "reference";
static OPT_IO_BLOCKS: &str = "io-blocks";
static OPT_SIZE: &str = "size"; static OPT_SIZE: &str = "size";
static ARG_FILES: &str = "files"; static ARG_FILES: &str = "files";
@ -77,18 +77,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.about(ABOUT) .about(ABOUT)
.usage(&usage[..]) .usage(&usage[..])
.after_help(&long_usage[..]) .after_help(&long_usage[..])
.arg(
Arg::with_name(OPT_NO_CREATE)
.short("c")
.long(OPT_NO_CREATE)
.help("do not create files that do not exist")
)
.arg( .arg(
Arg::with_name(OPT_IO_BLOCKS) Arg::with_name(OPT_IO_BLOCKS)
.short("o") .short("o")
.long(OPT_IO_BLOCKS) .long(OPT_IO_BLOCKS)
.help("treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)") .help("treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)")
) )
.arg(
Arg::with_name(OPT_NO_CREATE)
.short("c")
.long(OPT_NO_CREATE)
.help("do not create files that do not exist")
)
.arg( .arg(
Arg::with_name(OPT_REFERENCE) Arg::with_name(OPT_REFERENCE)
.short("r") .short("r")
@ -115,8 +115,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
show_error!("Missing an argument"); show_error!("Missing an argument");
return 1; return 1;
} else { } else {
let no_create = matches.is_present(OPT_NO_CREATE);
let io_blocks = matches.is_present(OPT_IO_BLOCKS); let io_blocks = matches.is_present(OPT_IO_BLOCKS);
let no_create = matches.is_present(OPT_NO_CREATE);
let reference = matches.value_of(OPT_REFERENCE).map(String::from); let reference = matches.value_of(OPT_REFERENCE).map(String::from);
let size = matches.value_of(OPT_SIZE).map(String::from); let size = matches.value_of(OPT_SIZE).map(String::from);
if reference.is_none() && size.is_none() { if reference.is_none() && size.is_none() {