1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 05:27:45 +00:00

refactor/readline ~ changes based on PR feedback

- add a trailing "." to ABOUT for consistency
- rename OPT_FILES => ARG_FILES
- move to alphabetical order for OPTIONs (where reasonable)

Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
This commit is contained in:
Sylvestre Ledru 2020-10-25 10:07:03 +01:00 committed by Roy Ivy III
parent 733fe925ad
commit e06aaace59

View file

@ -20,16 +20,17 @@ use uucore::fs::{canonicalize, CanonicalizeMode};
const NAME: &str = "readlink";
const VERSION: &str = env!("CARGO_PKG_VERSION");
const ABOUT: &str = "Print value of a symbolic link or canonical file name";
const ABOUT: &str = "Print value of a symbolic link or canonical file name.";
const OPT_CANONICALIZE: &str = "canonicalize";
const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
const OPT_ZERO: &str = "zero";
const OPT_NO_NEWLINE: &str = "no-newline";
const OPT_QUIET: &str = "quiet";
const OPT_SILENT: &str = "silent";
const OPT_VERBOSE: &str = "verbose";
const OPT_FILES: &str = "files";
const OPT_ZERO: &str = "zero";
const ARG_FILES: &str = "files";
fn get_usage() -> String {
format!("{0} [OPTION]... [FILE]...", executable!())
@ -98,7 +99,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.long(OPT_ZERO)
.help("separate output with NUL rather than newline"),
)
.arg(Arg::with_name(OPT_FILES).multiple(true).takes_value(true))
.arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true))
.get_matches_from(args);
let mut no_newline = matches.is_present(OPT_NO_NEWLINE);
@ -117,7 +118,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
};
let files: Vec<String> = matches
.values_of(OPT_FILES)
.values_of(ARG_FILES)
.map(|v| v.map(ToString::to_string).collect())
.unwrap_or_default();
if files.is_empty() {