diff --git a/src/chown/chown.rs b/src/chown/chown.rs index 558ce9ce1..f4c27710d 100644 --- a/src/chown/chown.rs +++ b/src/chown/chown.rs @@ -42,38 +42,35 @@ pub fn uumain(args: Vec) -> i32 { let mut opts = new_coreopts!(SYNTAX, SUMMARY, ""); opts.optflag("c", "changes", - "like verbose but report only when a change is made"); - opts.optflag("f", "silent", ""); - opts.optflag("", "quiet", "suppress most error messages"); - opts.optflag("v", + "like verbose but report only when a change is made") + .optflag("f", "silent", "") + .optflag("", "quiet", "suppress most error messages") + .optflag("v", "verbose", - "output a diagnostic for every file processed"); - opts.optflag("", "dereference", "affect the referent of each symbolic link (this is the default), rather than the symbolic link itself"); - opts.optflag("h", "no-dereference", "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)"); + "output a diagnostic for every file processed") + .optflag("", "dereference", "affect the referent of each symbolic link (this is the default), rather than the symbolic link itself") + .optflag("h", "no-dereference", "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)") - opts.optopt("", "from", "change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute", "CURRENT_OWNER:CURRENT_GROUP"); - opts.optopt("", + .optopt("", "from", "change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute", "CURRENT_OWNER:CURRENT_GROUP") + .optopt("", "reference", "use RFILE's owner and group rather than specifying OWNER:GROUP values", - "RFILE"); - - opts.optflag("", + "RFILE") + .optflag("", "no-preserve-root", - "do not treat '/' specially (the default)"); - opts.optflag("", "preserve-root", "fail to operate recursively on '/'"); + "do not treat '/' specially (the default)") + .optflag("", "preserve-root", "fail to operate recursively on '/'") - opts.optflag("R", + .optflag("R", "recursive", - "operate on files and directories recursively"); - opts.optflag("H", + "operate on files and directories recursively") + .optflag("H", "", - "if a command line argument is a symbolic link to a directory, traverse it"); - opts.optflag("L", + "if a command line argument is a symbolic link to a directory, traverse it") + .optflag("L", "", - "traverse every symbolic link to a directory encountered"); - opts.optflag("P", "", "do not traverse any symbolic links (default)"); - - let matches = opts.parse(args.clone()); + "traverse every symbolic link to a directory encountered") + .optflag("P", "", "do not traverse any symbolic links (default)"); let mut bit_flag = FTS_PHYSICAL; let mut preserve_root = false; @@ -100,6 +97,7 @@ pub fn uumain(args: Vec) -> i32 { } } + let matches = opts.parse(args); let recursive = matches.opt_present("recursive"); if recursive { if bit_flag == FTS_PHYSICAL { diff --git a/src/cut/cut.rs b/src/cut/cut.rs index 0250ef194..cd2f303df 100644 --- a/src/cut/cut.rs +++ b/src/cut/cut.rs @@ -291,7 +291,7 @@ fn cut_fields(reader: R, ranges: &[Range], opts: &FieldOptions) -> i32 match opts.out_delimeter { Some(ref o_delim) => { return cut_fields_delimiter(reader, ranges, &opts.delimiter, - opts.only_delimited, newline_char, o_delim); + opts.only_delimited, newline_char, o_delim) } None => () } @@ -417,18 +417,17 @@ fn cut_files(mut filenames: Vec, mode: Mode) -> i32 { } pub fn uumain(args: Vec) -> i32 { - let mut opts = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP); - opts.optopt("b", "bytes", "filter byte columns from the input source", "sequence"); - opts.optopt("c", "characters", "alias for character mode", "sequence"); - opts.optopt("d", "delimiter", "specify the delimiter character that separates fields in the input source. Defaults to Tab.", "delimiter"); - opts.optopt("f", "fields", "filter field columns from the input source", "sequence"); - opts.optflag("n", "", "legacy option - has no effect."); - opts.optflag("", "complement", "invert the filter - instead of displaying only the filtered columns, display all but those columns"); - opts.optflag("s", "only-delimited", "in field mode, only print lines which contain the delimiter"); - opts.optflag("z", "zero-terminated", "instead of filtering columns based on line, filter columns based on \\0 (NULL character)"); - opts.optopt("", "output-delimiter", "in field mode, replace the delimiter in output lines with this option's argument", "new delimiter"); - let matches = opts.parse(args); - + let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP) + .optopt("b", "bytes", "filter byte columns from the input source", "sequence") + .optopt("c", "characters", "alias for character mode", "sequence") + .optopt("d", "delimiter", "specify the delimiter character that separates fields in the input source. Defaults to Tab.", "delimiter") + .optopt("f", "fields", "filter field columns from the input source", "sequence") + .optflag("n", "", "legacy option - has no effect.") + .optflag("", "complement", "invert the filter - instead of displaying only the filtered columns, display all but those columns") + .optflag("s", "only-delimited", "in field mode, only print lines which contain the delimiter") + .optflag("z", "zero-terminated", "instead of filtering columns based on line, filter columns based on \\0 (NULL character)") + .optopt("", "output-delimiter", "in field mode, replace the delimiter in output lines with this option's argument", "new delimiter") + .parse(args); let complement = matches.opt_present("complement"); let mode_parse = match (matches.opt_str("bytes"), diff --git a/src/groups/groups.rs b/src/groups/groups.rs index f279eb1d3..fb72ff0ef 100644 --- a/src/groups/groups.rs +++ b/src/groups/groups.rs @@ -19,8 +19,8 @@ static SYNTAX: &'static str = "[user]"; static SUMMARY: &'static str = "display current group names"; pub fn uumain(args: Vec) -> i32 { - let mut opts = new_coreopts!(SYNTAX, SUMMARY, ""); - let matches = opts.parse(args); + let matches = new_coreopts!(SYNTAX, SUMMARY, "") + .parse(args); if matches.free.is_empty() { println!("{}", get_groups().unwrap().iter().map(|&g| gid2grp(g).unwrap()).collect::>().join(" "));