mirror of
https://github.com/uutils/coreutils
synced 2024-11-15 01:17:09 +00:00
Minor code reformatings and adding missing arg shortcuts
This commit is contained in:
parent
dfb68841fd
commit
01d426af01
2 changed files with 9 additions and 10 deletions
|
@ -29,11 +29,10 @@ fn main() {
|
|||
let args = ~os::args();
|
||||
let opts = ~[
|
||||
optflag("d", "decode", "decode data"),
|
||||
optflag("i", "ignore-garbage",
|
||||
"when decoding, ignore non-alphabetic characters"),
|
||||
optflag("i", "ignore-garbage", "when decoding, ignore non-alphabetic characters"),
|
||||
optopt("w", "wrap",
|
||||
"wrap encoded lines after COLS character (default 76, 0 to \
|
||||
disable wrapping)", "COLS"),
|
||||
"wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", "COLS"
|
||||
),
|
||||
optflag("h", "help", "display this help text and exit"),
|
||||
optflag("V", "version", "output version information and exit")
|
||||
];
|
||||
|
@ -46,8 +45,7 @@ fn main() {
|
|||
};
|
||||
|
||||
let progname = args[0].clone();
|
||||
let usage = usage("Base64 encode or decode FILE, or standard input, to \
|
||||
standard output.", opts);
|
||||
let usage = usage("Base64 encode or decode FILE, or standard input, to standard output.", opts);
|
||||
let mode = if matches.opt_present("help") {
|
||||
Help
|
||||
} else if matches.opt_present("version") {
|
||||
|
@ -62,8 +60,7 @@ fn main() {
|
|||
Some(s) => match from_str(s) {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
error!("error: {:s}", "Argument to option 'wrap' \
|
||||
improperly formatted.");
|
||||
error!("error: {:s}", "Argument to option 'wrap' improperly formatted.");
|
||||
fail!()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -41,8 +41,10 @@ fn options(args: &[~str]) -> Result<Options, ()> {
|
|||
let opts = ~[
|
||||
optflag("a", "append", "append to the given FILEs, do not overwrite"),
|
||||
optflag("i", "ignore-interrupts", "ignore interrupt signals"),
|
||||
optflag("", "help", "display this help and exit"),
|
||||
optflag("", "version", "output version information and exit")];
|
||||
optflag("h", "help", "display this help and exit"),
|
||||
optflag("V", "version", "output version information and exit"),
|
||||
];
|
||||
|
||||
getopts(args.tail(), opts).map_err(|e| e.to_err_msg()).and_then(|m| {
|
||||
let version = format!("{} {}", NAME, VERSION);
|
||||
let program = args[0].clone();
|
||||
|
|
Loading…
Reference in a new issue