1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 19:56:17 +00:00

printenv: update to clap 4

This commit is contained in:
Terts Diepraam 2022-09-30 16:08:22 +02:00
parent 8ac1eaf2d6
commit 63b751f351
2 changed files with 8 additions and 8 deletions

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/printenv.rs" path = "src/printenv.rs"
[dependencies] [dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] } clap = { version = "4.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" } uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
[[bin]] [[bin]]

View file

@ -7,7 +7,7 @@
/* last synced with: printenv (GNU coreutils) 8.13 */ /* last synced with: printenv (GNU coreutils) 8.13 */
use clap::{crate_version, Arg, Command}; use clap::{crate_version, Arg, ArgAction, Command};
use std::env; use std::env;
use uucore::{error::UResult, format_usage}; use uucore::{error::UResult, format_usage};
@ -27,7 +27,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.map(|v| v.map(ToString::to_string).collect()) .map(|v| v.map(ToString::to_string).collect())
.unwrap_or_default(); .unwrap_or_default();
let separator = if matches.contains_id(OPT_NULL) { let separator = if matches.get_flag(OPT_NULL) {
"\x00" "\x00"
} else { } else {
"\n" "\n"
@ -56,7 +56,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
@ -66,12 +66,12 @@ pub fn uu_app<'a>() -> Command<'a> {
Arg::new(OPT_NULL) Arg::new(OPT_NULL)
.short('0') .short('0')
.long(OPT_NULL) .long(OPT_NULL)
.help("end each output line with 0 byte rather than newline"), .help("end each output line with 0 byte rather than newline")
.action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(ARG_VARIABLES) Arg::new(ARG_VARIABLES)
.multiple_occurrences(true) .action(ArgAction::Append)
.takes_value(true) .num_args(1..),
.min_values(1),
) )
} }