base32: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 12:20:38 +01:00
parent 0fb7ceb1a0
commit 031bde97bf
3 changed files with 11 additions and 11 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/base32.rs"
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features = ["encoding"] }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }

View file

@ -47,6 +47,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
)
}
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
base_common::base_app(ABOUT)
}

View file

@ -86,33 +86,33 @@ impl Config {
}
pub fn parse_base_cmd_args(args: impl uucore::Args, about: &str, usage: &str) -> UResult<Config> {
let app = base_app(about).usage(usage);
let app = base_app(about).override_usage(usage);
let arg_list = args
.collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any();
Config::from(&app.get_matches_from(arg_list))
}
pub fn base_app<'a>(about: &'a str) -> App<'static, 'a> {
pub fn base_app(about: &str) -> App {
App::new(uucore::util_name())
.version(crate_version!())
.about(about)
// Format arguments.
.arg(
Arg::with_name(options::DECODE)
.short("d")
Arg::new(options::DECODE)
.short('d')
.long(options::DECODE)
.help("decode data"),
)
.arg(
Arg::with_name(options::IGNORE_GARBAGE)
.short("i")
Arg::new(options::IGNORE_GARBAGE)
.short('i')
.long(options::IGNORE_GARBAGE)
.help("when decoding, ignore non-alphabetic characters"),
)
.arg(
Arg::with_name(options::WRAP)
.short("w")
Arg::new(options::WRAP)
.short('w')
.long(options::WRAP)
.takes_value(true)
.help(
@ -121,7 +121,7 @@ pub fn base_app<'a>(about: &'a str) -> App<'static, 'a> {
)
// "multiple" arguments are used to check whether there is more than one
// file passed in.
.arg(Arg::with_name(options::FILE).index(1).multiple(true))
.arg(Arg::new(options::FILE).index(1).multiple_occurrences(true))
}
pub fn get_input<'a>(config: &Config, stdin_ref: &'a Stdin) -> UResult<Box<dyn Read + 'a>> {