1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-18 04:36:18 +00:00

expand: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 13:28:05 +01:00
parent 4d917e28b2
commit 449a536c59
2 changed files with 12 additions and 12 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/expand.rs" path = "src/expand.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
unicode-width = "0.1.5" unicode-width = "0.1.5"
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

@ -174,39 +174,39 @@ impl Options {
#[uucore_procs::gen_uumain] #[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from(args); let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
expand(Options::new(&matches)).map_err_context(|| "failed to write output".to_string()) expand(Options::new(&matches)).map_err_context(|| "failed to write output".to_string())
} }
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)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.arg( .arg(
Arg::with_name(options::INITIAL) Arg::new(options::INITIAL)
.long(options::INITIAL) .long(options::INITIAL)
.short("i") .short('i')
.help("do not convert tabs after non blanks"), .help("do not convert tabs after non blanks"),
) )
.arg( .arg(
Arg::with_name(options::TABS) Arg::new(options::TABS)
.long(options::TABS) .long(options::TABS)
.short("t") .short('t')
.value_name("N, LIST") .value_name("N, LIST")
.takes_value(true) .takes_value(true)
.help("have tabs N characters apart, not 8 or use comma separated list of explicit tab positions"), .help("have tabs N characters apart, not 8 or use comma separated list of explicit tab positions"),
) )
.arg( .arg(
Arg::with_name(options::NO_UTF8) Arg::new(options::NO_UTF8)
.long(options::NO_UTF8) .long(options::NO_UTF8)
.short("U") .short('U')
.help("interpret input file as 8-bit ASCII rather than UTF-8"), .help("interpret input file as 8-bit ASCII rather than UTF-8"),
).arg( ).arg(
Arg::with_name(options::FILES) Arg::new(options::FILES)
.multiple(true) .multiple_occurrences(true)
.hidden(true) .hide(true)
.takes_value(true) .takes_value(true)
) )
} }