Update crate clap to 3.0.4

This commit is contained in:
Fabrice Reix 2022-01-06 20:35:23 +01:00 committed by Fabrice Reix
parent ba3d600cc2
commit e12d0f1dd3
6 changed files with 104 additions and 96 deletions

70
Cargo.lock generated
View File

@ -32,15 +32,6 @@ dependencies = [
"alloc-no-stdlib",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "atty"
version = "0.2.14"
@ -154,17 +145,18 @@ dependencies = [
[[package]]
name = "clap"
version = "2.34.0"
version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
checksum = "d01c9347757e131122b19cd19a05c85805b68c2352a97b623efdc3c295290299"
dependencies = [
"ansi_term",
"atty",
"bitflags",
"indexmap",
"lazy_static",
"os_str_bytes",
"strsim",
"termcolor",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]]
@ -599,6 +591,15 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]
[[package]]
name = "percent-encoding"
version = "2.1.0"
@ -859,9 +860,9 @@ dependencies = [
[[package]]
name = "strsim"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "sxd-document"
@ -887,6 +888,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "termcolor"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [
"winapi-util",
]
[[package]]
name = "termion"
version = "1.5.6"
@ -901,12 +911,9 @@ dependencies = [
[[package]]
name = "textwrap"
version = "0.11.0"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
[[package]]
name = "time"
@ -964,12 +971,6 @@ dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-width"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
[[package]]
name = "url"
version = "2.2.2"
@ -988,12 +989,6 @@ version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c"
[[package]]
name = "vec_map"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
[[package]]
name = "version_check"
version = "0.9.3"
@ -1037,6 +1032,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"

View File

@ -21,7 +21,7 @@ atty = "0.2.14"
base64 = "0.13.0"
brotli = "3.3.2"
chrono = "0.4.19"
clap = "2.34.0"
clap = { version = "3.0.4", features = ["cargo"] }
colored = "2.0.0"
curl = "0.4.41"
encoding = "0.2.33"

View File

@ -66,196 +66,198 @@ pub enum OutputType {
Json,
NoOutput,
}
pub fn app() -> App<'static, 'static> {
App::new("hurl")
pub fn app(version: &str) -> App {
clap::App::new("hurl")
.about("Run hurl FILE(s) or standard input")
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::UnifiedHelpMessage)
.setting(AppSettings::DisableColoredHelp)
.version(version)
.arg(
clap::Arg::with_name("INPUT")
clap::Arg::new("INPUT")
.help("Sets the input file to use")
.required(false)
.multiple(true),
.multiple_occurrences(true),
)
.arg(
clap::Arg::with_name("cacert_file")
clap::Arg::new("cacert_file")
.long("cacert")
.value_name("FILE")
.help("CA certificate to verify peer against (PEM format)"),
)
.arg(
clap::Arg::with_name("color")
clap::Arg::new("color")
.long("color")
.conflicts_with("no_color")
.help("Colorize Output"),
)
.arg(
clap::Arg::with_name("compressed")
clap::Arg::new("compressed")
.long("compressed")
.help("Request compressed response (using deflate or gzip)"),
)
.arg(
clap::Arg::with_name("connect_timeout")
clap::Arg::new("connect_timeout")
.long("connect-timeout")
.value_name("SECONDS")
.help("Maximum time allowed for connection"),
)
.arg(
clap::Arg::with_name("cookies_input_file")
.short("b")
clap::Arg::new("cookies_input_file")
.short('b')
.long("cookie")
.value_name("FILE")
.help("Read cookies from FILE"),
)
.arg(
clap::Arg::with_name("cookies_output_file")
.short("c")
clap::Arg::new("cookies_output_file")
.short('c')
.long("cookie-jar")
.value_name("FILE")
.help("Write cookies to FILE after running the session (only for one session)"),
)
.arg(
clap::Arg::with_name("fail_at_end")
clap::Arg::new("fail_at_end")
.long("fail-at-end")
.help("Fail at end")
.takes_value(false),
)
.arg(
clap::Arg::with_name("file_root")
clap::Arg::new("file_root")
.long("file-root")
.value_name("DIR")
.help("set root filesystem to import file in hurl (default is current directory)")
.takes_value(true),
)
.arg(
clap::Arg::with_name("follow_location")
.short("L")
clap::Arg::new("follow_location")
.short('L')
.long("location")
.help("Follow redirects"),
)
.arg(
clap::Arg::with_name("glob")
clap::Arg::new("glob")
.long("glob")
.value_name("GLOB")
.multiple(true)
.multiple_occurrences(true)
.number_of_values(1)
.help("Specify input files that match the given blob. Multiple glob flags may be used."),
)
.arg(
clap::Arg::with_name("html")
clap::Arg::new("html")
.long("html")
.value_name("DIR")
.help("Generate html report to dir")
.takes_value(true),
)
.arg(
clap::Arg::with_name("include")
.short("i")
clap::Arg::new("include")
.short('i')
.long("include")
.help("Include the HTTP headers in the output"),
)
.arg(
clap::Arg::with_name("ignore_asserts")
clap::Arg::new("ignore_asserts")
.long("ignore-asserts")
.help("Ignore asserts defined in the Hurl file."),
)
.arg(
clap::Arg::with_name("insecure")
.short("k")
clap::Arg::new("insecure")
.short('k')
.long("insecure")
.help("Allow insecure SSL connections"),
)
.arg(
clap::Arg::with_name("interactive")
clap::Arg::new("interactive")
.long("interactive")
.conflicts_with("to_entry")
.help("Turn on interactive mode"),
)
.arg(
clap::Arg::with_name("json")
clap::Arg::new("json")
.long("json")
.conflicts_with("no_output")
.help("Output each hurl file result to JSON"),
)
.arg(
clap::Arg::with_name("junit")
clap::Arg::new("junit")
.long("report-junit")
.value_name("FILE")
.help("Write a Junit XML report to the given file")
.takes_value(true),
)
.arg(
clap::Arg::with_name("max_time")
clap::Arg::new("max_time")
.long("max-time")
.short("m")
.short('m')
.value_name("NUM")
.allow_hyphen_values(true)
.help("Maximum time allowed for the transfer"),
)
.arg(
clap::Arg::with_name("max_redirects")
clap::Arg::new("max_redirects")
.long("max-redirs")
.value_name("NUM")
.allow_hyphen_values(true)
.help("Maximum number of redirects allowed"),
)
.arg(
clap::Arg::with_name("no_color")
clap::Arg::new("no_color")
.long("no-color")
.conflicts_with("color")
.help("Do not colorize Output"),
)
.arg(
clap::Arg::with_name("no_output")
clap::Arg::new("no_output")
.long("no-output")
.conflicts_with("json")
.help("Suppress output. By default, Hurl outputs the body of the last response."),
)
.arg(
clap::Arg::with_name("noproxy")
clap::Arg::new("noproxy")
.long("noproxy")
.value_name("HOST(S)")
.help("List of hosts which do not use proxy")
.takes_value(true),
)
.arg(
clap::Arg::with_name("output")
.short("o")
clap::Arg::new("output")
.short('o')
.long("output")
.value_name("FILE")
.help("Write to FILE instead of stdout"),
)
.arg(
clap::Arg::with_name("progress")
clap::Arg::new("progress")
.long("progress")
.help("Print filename and status for each test (stderr)"),
)
.arg(
clap::Arg::with_name("proxy")
.short("x")
clap::Arg::new("proxy")
.short('x')
.long("proxy")
.value_name("[PROTOCOL://]HOST[:PORT]")
.help("Use proxy on given protocol/host/port"),
)
.arg(
clap::Arg::with_name("report_html")
clap::Arg::new("report_html")
.long("report-html")
.value_name("DIR")
.help("Generate html report to dir")
.takes_value(true),
)
.arg(
clap::Arg::with_name("summary")
clap::Arg::new("summary")
.long("summary")
.help("Print test metrics at the end of the run (stderr)"),
)
.arg(
clap::Arg::with_name("test")
clap::Arg::new("test")
.long("test")
.help("Activate test mode; equals --no-output --progress --summary"),
)
.arg(
clap::Arg::with_name("to_entry")
clap::Arg::new("to_entry")
.long("to-entry")
.value_name("ENTRY_NUMBER")
.conflicts_with("interactive")
@ -263,32 +265,32 @@ pub fn app() -> App<'static, 'static> {
.takes_value(true),
)
.arg(
clap::Arg::with_name("user")
.short("u")
clap::Arg::new("user")
.short('u')
.long("user")
.value_name("user:password")
.help("Add basic Authentication header to each request.")
.takes_value(true),
)
.arg(
clap::Arg::with_name("variable")
clap::Arg::new("variable")
.long("variable")
.value_name("NAME=VALUE")
.multiple(true)
.multiple_occurrences(true)
.number_of_values(1)
.help("Define a variable")
.takes_value(true),
)
.arg(
clap::Arg::with_name("variables_file")
clap::Arg::new("variables_file")
.long("variables-file")
.value_name("FILE")
.help("Define a properties file in which you define your variables")
.takes_value(true),
)
.arg(
clap::Arg::with_name("verbose")
.short("v")
clap::Arg::new("verbose")
.short('v')
.long("verbose")
.help("Turn on verbose output"),
)

View File

@ -251,7 +251,7 @@ fn main() {
clap::crate_version!(),
http::libcurl_version_info().join(" ")
);
let app = cli::app().version(version_info.as_str());
let app = cli::app(version_info.as_str());
let matches = app.clone().get_matches();
init_colored();

View File

@ -16,7 +16,7 @@ strict = []
[dependencies]
atty = "0.2.14"
base64 = "0.13.0"
clap = "2.34.0"
clap = { version = "3.0.1", features = ["cargo"] }
colored = "2.0.0"
hurl_core = { version = "1.6.0-snapshot", path = "../hurl_core" }
regex = "1.5.4"

View File

@ -22,6 +22,7 @@ use std::process;
use atty::Stream;
use clap::AppSettings;
use hurl_core::parser;
use hurlfmt::cli;
use hurlfmt::format;
@ -42,61 +43,62 @@ fn main() {
let app = clap::App::new("hurlfmt")
// .author(clap::crate_authors!())
.version(clap::crate_version!())
.setting(AppSettings::DisableColoredHelp)
.about("Format hurl FILE")
.arg(
clap::Arg::with_name("INPUT")
clap::Arg::new("INPUT")
.help("Sets the input file to use")
.required(false)
.index(1),
)
.arg(
clap::Arg::with_name("check")
clap::Arg::new("check")
.long("check")
.conflicts_with("format")
.conflicts_with("output")
.help("Run in 'check' mode"),
)
.arg(
clap::Arg::with_name("color")
clap::Arg::new("color")
.long("color")
.conflicts_with("no_color")
.conflicts_with("in_place")
.help("Colorize Output"),
)
.arg(
clap::Arg::with_name("format")
clap::Arg::new("format")
.long("format")
.conflicts_with("check")
.value_name("FORMAT")
.help("Specify output format: text (default), json or html"),
)
.arg(
clap::Arg::with_name("in_place")
clap::Arg::new("in_place")
.long("in-place")
.conflicts_with("output")
.conflicts_with("color")
.help("Modify file in place"),
)
.arg(
clap::Arg::with_name("no_color")
clap::Arg::new("no_color")
.long("no-color")
.conflicts_with("color")
.help("Do not colorize output"),
)
.arg(
clap::Arg::with_name("no_format")
clap::Arg::new("no_format")
.long("no-format")
.help("Do not format output"),
)
.arg(
clap::Arg::with_name("output")
.short("o")
clap::Arg::new("output")
.short('o')
.long("output")
.value_name("FILE")
.help("Write to FILE instead of stdout"),
)
.arg(
clap::Arg::with_name("standalone")
clap::Arg::new("standalone")
.long("standalone")
.help("Standalone Html"),
);