Skip to content

Commit

Permalink
Merge pull request #3229 from uutils/dependabot/cargo/clap-3.1.6
Browse files Browse the repository at this point in the history
build(deps): bump clap from 3.0.10 to 3.1.6
  • Loading branch information
sylvestre authored Mar 20, 2022
2 parents b55da29 + d90a81f commit 04b219b
Show file tree
Hide file tree
Showing 209 changed files with 809 additions and 739 deletions.
216 changes: 108 additions & 108 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
16 changes: 8 additions & 8 deletions src/bin/coreutils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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")
Expand All @@ -155,23 +155,23 @@ 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()
};
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
}
32 changes: 16 additions & 16 deletions src/bin/uudoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand All @@ -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(())
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/uu/arch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
8 changes: 4 additions & 4 deletions src/uu/arch/src/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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)
}
2 changes: 1 addition & 1 deletion src/uu/base32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
4 changes: 2 additions & 2 deletions src/uu/base32/src/base32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}
12 changes: 6 additions & 6 deletions src/uu/base32/src/base_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/uu/basename/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
8 changes: 4 additions & 4 deletions src/uu/basename/src/basename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/uu/basenc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

Expand Down
10 changes: 5 additions & 5 deletions src/uu/basenc/src/basenc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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)> {
Expand Down
2 changes: 1 addition & 1 deletion src/uu/cat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
8 changes: 4 additions & 4 deletions src/uu/cat/src/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/uu/chcon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Loading

0 comments on commit 04b219b

Please sign in to comment.