Merge pull request #3229 from uutils/dependabot/cargo/clap-3.1.6

build(deps): bump clap from 3.0.10 to 3.1.6
This commit is contained in:
Sylvestre Ledru
2022-03-20 17:44:33 +01:00
committed by GitHub
209 changed files with 809 additions and 739 deletions
Generated
+108 -108
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -245,11 +245,11 @@ test = [ "uu_test" ]
[workspace]
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
clap_complete = "3.0"
phf = "0.10.1"
lazy_static = { version="1.3" }
textwrap = { version="0.14", features=["terminal_size"] }
textwrap = { version="0.15", features=["terminal_size"] }
uucore = { version=">=0.0.11", package="uucore", path="src/uucore" }
selinux = { version="0.2", optional = true }
ureq = "2.4.0"
+1 -1
View File
@@ -43,7 +43,7 @@ pub fn main() {
let mut tf = File::create(Path::new(&out_dir).join("test_modules.rs")).unwrap();
mf.write_all(
"type UtilityMap<T> = phf::Map<&'static str, (fn(T) -> i32, fn() -> App<'static>)>;\n\
"type UtilityMap<T> = phf::Map<&'static str, (fn(T) -> i32, fn() -> Command<'static>)>;\n\
\n\
fn util_map<T: uucore::Args>() -> UtilityMap<T> {\n"
.as_bytes(),
+8 -8
View File
@@ -5,7 +5,7 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use clap::{App, Arg};
use clap::{Arg, Command};
use clap_complete::Shell;
use std::cmp;
use std::ffi::OsStr;
@@ -138,7 +138,7 @@ fn gen_completions<T: uucore::Args>(
.chain(util_map.keys().copied())
.collect();
let matches = App::new("completion")
let matches = Command::new("completion")
.about("Prints completions to stdout")
.arg(
Arg::new("utility")
@@ -155,7 +155,7 @@ fn gen_completions<T: uucore::Args>(
let utility = matches.value_of("utility").unwrap();
let shell = matches.value_of("shell").unwrap();
let mut app = if utility == "coreutils" {
let mut command = if utility == "coreutils" {
gen_coreutils_app(util_map)
} else {
util_map.get(utility).unwrap().1()
@@ -163,15 +163,15 @@ fn gen_completions<T: uucore::Args>(
let shell: Shell = shell.parse().unwrap();
let bin_name = std::env::var("PROG_PREFIX").unwrap_or_default() + utility;
clap_complete::generate(shell, &mut app, bin_name, &mut io::stdout());
clap_complete::generate(shell, &mut command, bin_name, &mut io::stdout());
io::stdout().flush().unwrap();
process::exit(0);
}
fn gen_coreutils_app<T: uucore::Args>(util_map: &UtilityMap<T>) -> App<'static> {
let mut app = App::new("coreutils");
fn gen_coreutils_app<T: uucore::Args>(util_map: &UtilityMap<T>) -> Command<'static> {
let mut command = Command::new("coreutils");
for (_, (_, sub_app)) in util_map {
app = app.subcommand(sub_app());
command = command.subcommand(sub_app());
}
app
command
}
+16 -16
View File
@@ -4,7 +4,7 @@
// file that was distributed with this source code.
// spell-checker:ignore tldr
use clap::App;
use clap::Command;
use std::ffi::OsString;
use std::fs::File;
use std::io::Cursor;
@@ -46,13 +46,13 @@ fn main() -> io::Result<()> {
let mut utils = utils.entries().collect::<Vec<_>>();
utils.sort();
for (&name, (_, app)) in utils {
for (&name, (_, command)) in utils {
if name == "[" {
continue;
}
let p = format!("docs/src/utils/{}.md", name);
if let Ok(f) = File::create(&p) {
write_markdown(f, &mut app(), name, &mut tldr_zip)?;
write_markdown(f, &mut command(), name, &mut tldr_zip)?;
println!("Wrote to '{}'", p);
} else {
println!("Error writing to {}", p);
@@ -64,29 +64,29 @@ fn main() -> io::Result<()> {
fn write_markdown(
mut w: impl Write,
app: &mut App,
command: &mut Command,
name: &str,
tldr_zip: &mut zip::ZipArchive<impl Read + Seek>,
) -> io::Result<()> {
write!(w, "# {}\n\n", name)?;
write_version(&mut w, app)?;
write_usage(&mut w, app, name)?;
write_description(&mut w, app)?;
write_options(&mut w, app)?;
write_version(&mut w, command)?;
write_usage(&mut w, command, name)?;
write_description(&mut w, command)?;
write_options(&mut w, command)?;
write_examples(&mut w, name, tldr_zip)
}
fn write_version(w: &mut impl Write, app: &App) -> io::Result<()> {
fn write_version(w: &mut impl Write, command: &Command) -> io::Result<()> {
writeln!(
w,
"<div class=\"version\">version: {}</div>",
app.render_version().split_once(' ').unwrap().1
command.render_version().split_once(' ').unwrap().1
)
}
fn write_usage(w: &mut impl Write, app: &mut App, name: &str) -> io::Result<()> {
fn write_usage(w: &mut impl Write, command: &mut Command, name: &str) -> io::Result<()> {
writeln!(w, "\n```")?;
let mut usage: String = app
let mut usage: String = command
.render_usage()
.lines()
.skip(1)
@@ -99,8 +99,8 @@ fn write_usage(w: &mut impl Write, app: &mut App, name: &str) -> io::Result<()>
writeln!(w, "```")
}
fn write_description(w: &mut impl Write, app: &App) -> io::Result<()> {
if let Some(about) = app.get_long_about().or_else(|| app.get_about()) {
fn write_description(w: &mut impl Write, command: &Command) -> io::Result<()> {
if let Some(about) = command.get_long_about().or_else(|| command.get_about()) {
writeln!(w, "{}", about)
} else {
Ok(())
@@ -152,10 +152,10 @@ fn get_zip_content(archive: &mut ZipArchive<impl Read + Seek>, name: &str) -> Op
Some(s)
}
fn write_options(w: &mut impl Write, app: &App) -> io::Result<()> {
fn write_options(w: &mut impl Write, command: &Command) -> io::Result<()> {
writeln!(w, "<h2>Options</h2>")?;
write!(w, "<dl>")?;
for arg in app.get_arguments() {
for arg in command.get_arguments() {
write!(w, "<dt>")?;
let mut first = true;
for l in arg.get_long_and_visible_aliases().unwrap_or_default() {
+1 -1
View File
@@ -16,7 +16,7 @@ path = "src/arch.rs"
[dependencies]
platform-info = "0.2"
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]]
+4 -4
View File
@@ -8,7 +8,7 @@
use platform_info::*;
use clap::{crate_version, App, AppSettings};
use clap::{crate_version, Command};
use uucore::error::{FromIo, UResult};
static ABOUT: &str = "Display machine architecture";
@@ -23,10 +23,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(())
}
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.after_help(SUMMARY)
.setting(AppSettings::InferLongArgs)
.infer_long_args(true)
}
+1 -1
View File
@@ -15,7 +15,7 @@ edition = "2018"
path = "src/base32.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] }
[[bin]]
+2 -2
View File
@@ -7,7 +7,7 @@
use std::io::{stdin, Read};
use clap::App;
use clap::Command;
use uucore::{encoding::Format, error::UResult};
pub mod base_common;
@@ -44,6 +44,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
)
}
pub fn uu_app<'a>() -> App<'a> {
pub fn uu_app<'a>() -> Command<'a> {
base_common::base_app(ABOUT, USAGE)
}
+6 -6
View File
@@ -18,7 +18,7 @@ use std::fs::File;
use std::io::{BufReader, Stdin};
use std::path::Path;
use clap::{crate_version, App, AppSettings, Arg};
use clap::{crate_version, Arg, Command};
pub static BASE_CMD_PARSE_ERROR: i32 = 1;
@@ -86,19 +86,19 @@ impl Config {
}
pub fn parse_base_cmd_args(args: impl uucore::Args, about: &str, usage: &str) -> UResult<Config> {
let app = base_app(about, usage);
let command = base_app(about, usage);
let arg_list = args
.collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any();
Config::from(&app.get_matches_from(arg_list))
Config::from(&command.get_matches_from(arg_list))
}
pub fn base_app<'a>(about: &'a str, usage: &'a str) -> App<'a> {
App::new(uucore::util_name())
pub fn base_app<'a>(about: &'a str, usage: &'a str) -> Command<'a> {
Command::new(uucore::util_name())
.version(crate_version!())
.about(about)
.override_usage(format_usage(usage))
.setting(AppSettings::InferLongArgs)
.infer_long_args(true)
// Format arguments.
.arg(
Arg::new(options::DECODE)
+1 -1
View File
@@ -15,7 +15,7 @@ edition = "2018"
path = "src/basename.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]]
+4 -4
View File
@@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) fullname
use clap::{crate_version, App, AppSettings, Arg};
use clap::{crate_version, Arg, Command};
use std::path::{is_separator, PathBuf};
use uucore::display::Quotable;
use uucore::error::{UResult, UUsageError};
@@ -87,12 +87,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(())
}
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name())
.version(crate_version!())
.about(SUMMARY)
.override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs)
.infer_long_args(true)
.arg(
Arg::new(options::MULTIPLE)
.short('a')
+1 -1
View File
@@ -15,7 +15,7 @@ edition = "2018"
path = "src/basenc.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] }
uu_base32 = { version=">=0.0.8", package="uu_base32", path="../base32"}
+5 -5
View File
@@ -8,7 +8,7 @@
//spell-checker:ignore (args) lsbf msbf
use clap::{App, Arg};
use clap::{Arg, Command};
use uu_base32::base_common::{self, Config, BASE_CMD_PARSE_ERROR};
use uucore::{
@@ -40,12 +40,12 @@ const ENCODINGS: &[(&str, Format)] = &[
const USAGE: &str = "{} [OPTION]... [FILE]";
pub fn uu_app<'a>() -> App<'a> {
let mut app = base_common::base_app(ABOUT, USAGE);
pub fn uu_app<'a>() -> Command<'a> {
let mut command = base_common::base_app(ABOUT, USAGE);
for encoding in ENCODINGS {
app = app.arg(Arg::new(encoding.0).long(encoding.0));
command = command.arg(Arg::new(encoding.0).long(encoding.0));
}
app
command
}
fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> {
+1 -1
View File
@@ -15,7 +15,7 @@ edition = "2018"
path = "src/cat.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
thiserror = "1.0"
atty = "0.2"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "pipes"] }
+4 -4
View File
@@ -14,7 +14,7 @@
extern crate unix_socket;
// last synced with: cat (GNU coreutils) 8.13
use clap::{crate_version, App, AppSettings, Arg};
use clap::{crate_version, Arg, Command};
use std::fs::{metadata, File};
use std::io::{self, Read, Write};
use thiserror::Error;
@@ -239,13 +239,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
cat_files(&files, &options)
}
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name())
.name(NAME)
.version(crate_version!())
.override_usage(format_usage(USAGE))
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.infer_long_args(true)
.arg(
Arg::new(options::FILE)
.hide(true)
+1 -1
View File
@@ -14,7 +14,7 @@ edition = "2018"
path = "src/chcon.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version = ">=0.0.9", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] }
selinux = { version = "0.2" }
fts-sys = { version = "0.2" }
+12 -6
View File
@@ -6,7 +6,7 @@ use uucore::error::{UResult, USimpleError, UUsageError};
use uucore::format_usage;
use uucore::{display::Quotable, show_error, show_warning};
use clap::{App, AppSettings, Arg};
use clap::{Arg, Command};
use selinux::{OpaqueSecurityContext, SecurityContext};
use std::borrow::Cow;
@@ -29,6 +29,7 @@ const USAGE: &str = "\
{} [OPTION]... --reference=RFILE FILE...";
pub mod options {
pub static HELP: &str = "help";
pub static VERBOSE: &str = "verbose";
pub static REFERENCE: &str = "reference";
@@ -65,7 +66,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(r) => r,
Err(r) => {
if let Error::CommandLine(r) = &r {
match r.kind {
match r.kind() {
clap::ErrorKind::DisplayHelp | clap::ErrorKind::DisplayVersion => {
println!("{}", r);
return Ok(());
@@ -154,12 +155,17 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Err(libc::EXIT_FAILURE.into())
}
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name())
.version(VERSION)
.about(ABOUT)
.override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs)
.infer_long_args(true)
.arg(
Arg::new(options::HELP)
.long(options::HELP)
.help("Print help information."),
)
.arg(
Arg::new(options::dereference::DEREFERENCE)
.long(options::dereference::DEREFERENCE)
@@ -303,7 +309,7 @@ struct Options {
files: Vec<PathBuf>,
}
fn parse_command_line(config: clap::App, args: impl uucore::Args) -> Result<Options> {
fn parse_command_line(config: clap::Command, args: impl uucore::Args) -> Result<Options> {
let matches = config.try_get_matches_from(args)?;
let verbose = matches.is_present(options::VERBOSE);
+1 -1
View File
@@ -15,7 +15,7 @@ edition = "2018"
path = "src/chgrp.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] }
[[bin]]
+9 -4
View File
@@ -13,7 +13,7 @@ use uucore::error::{FromIo, UResult, USimpleError};
use uucore::format_usage;
use uucore::perms::{chown_base, options, IfFrom};
use clap::{App, AppSettings, Arg, ArgMatches};
use clap::{Arg, ArgMatches, Command};
use std::fs;
use std::os::unix::fs::MetadataExt;
@@ -54,12 +54,17 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
chown_base(uu_app(), args, options::ARG_GROUP, parse_gid_and_uid, true)
}
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name())
.version(VERSION)
.about(ABOUT)
.override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs)
.infer_long_args(true)
.arg(
Arg::new(options::HELP)
.long(options::HELP)
.help("Print help information.")
)
.arg(
Arg::new(options::verbosity::CHANGES)
.short('c')

Some files were not shown because too many files have changed in this diff Show More