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

tr: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 15:09:25 +01:00
parent 9f58715d65
commit fd777866a3
2 changed files with 15 additions and 15 deletions

View file

@ -17,7 +17,7 @@ path = "src/tr.rs"
[dependencies] [dependencies]
bit-set = "0.5.0" bit-set = "0.5.0"
fnv = "1.0.5" fnv = "1.0.5"
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" } uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }

View file

@ -246,7 +246,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let after_help = get_long_usage(); let after_help = get_long_usage();
let matches = uu_app() let matches = uu_app()
.usage(&usage[..]) .override_usage(&usage[..])
.after_help(&after_help[..]) .after_help(&after_help[..])
.get_matches_from(args); .get_matches_from(args);
@ -303,32 +303,32 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::COMPLEMENT) Arg::new(options::COMPLEMENT)
// .visible_short_alias('C') // TODO: requires clap "3.0.0-beta.2" // .visible_short_alias('C') // TODO: requires clap "3.0.0-beta.2"
.short("c") .short('c')
.long(options::COMPLEMENT) .long(options::COMPLEMENT)
.help("use the complement of SET1"), .help("use the complement of SET1"),
) )
.arg( .arg(
Arg::with_name("C") // work around for `Arg::visible_short_alias` Arg::new("C") // work around for `Arg::visible_short_alias`
.short("C") .short('C')
.help("same as -c"), .help("same as -c"),
) )
.arg( .arg(
Arg::with_name(options::DELETE) Arg::new(options::DELETE)
.short("d") .short('d')
.long(options::DELETE) .long(options::DELETE)
.help("delete characters in SET1, do not translate"), .help("delete characters in SET1, do not translate"),
) )
.arg( .arg(
Arg::with_name(options::SQUEEZE) Arg::new(options::SQUEEZE)
.long(options::SQUEEZE) .long(options::SQUEEZE)
.short("s") .short('s')
.help( .help(
"replace each sequence of a repeated character that is "replace each sequence of a repeated character that is
listed in the last specified SET, with a single occurrence listed in the last specified SET, with a single occurrence
@ -336,14 +336,14 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::TRUNCATE) Arg::new(options::TRUNCATE)
.long(options::TRUNCATE) .long(options::TRUNCATE)
.short("t") .short('t')
.help("first truncate SET1 to length of SET2"), .help("first truncate SET1 to length of SET2"),
) )
.arg( .arg(
Arg::with_name(options::SETS) Arg::new(options::SETS)
.multiple(true) .multiple_occurrences(true)
.takes_value(true) .takes_value(true)
.min_values(1) .min_values(1)
.max_values(2), .max_values(2),