mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 05:57:46 +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:
parent
733fe925ad
commit
e06aaace59
1 changed files with 6 additions and 5 deletions
|
@ -20,16 +20,17 @@ use uucore::fs::{canonicalize, CanonicalizeMode};
|
||||||
|
|
||||||
const NAME: &str = "readlink";
|
const NAME: &str = "readlink";
|
||||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
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: &str = "canonicalize";
|
||||||
const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
|
const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
|
||||||
const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
|
const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
|
||||||
const OPT_ZERO: &str = "zero";
|
|
||||||
const OPT_NO_NEWLINE: &str = "no-newline";
|
const OPT_NO_NEWLINE: &str = "no-newline";
|
||||||
const OPT_QUIET: &str = "quiet";
|
const OPT_QUIET: &str = "quiet";
|
||||||
const OPT_SILENT: &str = "silent";
|
const OPT_SILENT: &str = "silent";
|
||||||
const OPT_VERBOSE: &str = "verbose";
|
const OPT_VERBOSE: &str = "verbose";
|
||||||
const OPT_FILES: &str = "files";
|
const OPT_ZERO: &str = "zero";
|
||||||
|
|
||||||
|
const ARG_FILES: &str = "files";
|
||||||
|
|
||||||
fn get_usage() -> String {
|
fn get_usage() -> String {
|
||||||
format!("{0} [OPTION]... [FILE]...", executable!())
|
format!("{0} [OPTION]... [FILE]...", executable!())
|
||||||
|
@ -98,7 +99,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
.long(OPT_ZERO)
|
.long(OPT_ZERO)
|
||||||
.help("separate output with NUL rather than newline"),
|
.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);
|
.get_matches_from(args);
|
||||||
|
|
||||||
let mut no_newline = matches.is_present(OPT_NO_NEWLINE);
|
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
|
let files: Vec<String> = matches
|
||||||
.values_of(OPT_FILES)
|
.values_of(ARG_FILES)
|
||||||
.map(|v| v.map(ToString::to_string).collect())
|
.map(|v| v.map(ToString::to_string).collect())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
if files.is_empty() {
|
if files.is_empty() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue