1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-07 06:46:59 -05:00

chore: update clap and completions (#14136)

This commit is contained in:
Robert 2022-03-28 12:57:56 +11:00 committed by David Sherret
parent 2d7b44dde4
commit 51ac189cd5
4 changed files with 99 additions and 97 deletions

16
Cargo.lock generated
View file

@ -435,9 +435,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.0.7" version = "3.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e8611f9ae4e068fa3e56931fded356ff745e70987ff76924a6e0ab1c8ef2e3" checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
@ -450,18 +450,18 @@ dependencies = [
[[package]] [[package]]
name = "clap_complete" name = "clap_complete"
version = "3.0.5" version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4dabb7e2f006497e1da045feaa512acf0686f76b68d94925da2d9422dcb521" checksum = "df6f3613c0a3cddfd78b41b10203eb322cb29b600cbdf808a7d3db95691b8e25"
dependencies = [ dependencies = [
"clap", "clap",
] ]
[[package]] [[package]]
name = "clap_complete_fig" name = "clap_complete_fig"
version = "3.0.2" version = "3.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29cc003d824770d10072f4aa4a958e66d33d74a9cb7339595ac2a445d80d50a0" checksum = "690eb5abb7a98df1a64a3028beaf95af7e0ceb13da3186e6d0a86161af76309e"
dependencies = [ dependencies = [
"clap", "clap",
"clap_complete", "clap_complete",
@ -4485,9 +4485,9 @@ dependencies = [
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.14.2" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]] [[package]]
name = "thiserror" name = "thiserror"

View file

@ -57,9 +57,9 @@ atty = "=0.2.14"
base64 = "=0.13.0" base64 = "=0.13.0"
cache_control = "=0.2.0" cache_control = "=0.2.0"
chrono = "=0.4.19" chrono = "=0.4.19"
clap = "=3.0.7" clap = "=3.1.6"
clap_complete = "=3.0.5" clap_complete = "=3.1.1"
clap_complete_fig = "=3.0.2" clap_complete_fig = "=3.1.4"
data-url = "=0.1.1" data-url = "=0.1.1"
dissimilar = "=1.0.2" dissimilar = "=1.0.2"
dprint-plugin-json = "=0.14.1" dprint-plugin-json = "=0.14.1"

View file

@ -1,11 +1,9 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use clap::App;
use clap::AppSettings;
use clap::Arg; use clap::Arg;
use clap::ArgMatches; use clap::ArgMatches;
use clap::ArgSettings;
use clap::ColorChoice; use clap::ColorChoice;
use clap::Command;
use clap::ValueHint; use clap::ValueHint;
use deno_core::serde::Deserialize; use deno_core::serde::Deserialize;
use deno_core::serde::Serialize; use deno_core::serde::Serialize;
@ -535,8 +533,8 @@ fn handle_repl_flags(flags: &mut Flags, repl_flags: ReplFlags) {
flags.allow_hrtime = true; flags.allow_hrtime = true;
} }
fn clap_root(version: &str) -> App { fn clap_root(version: &str) -> Command {
clap::App::new("deno") clap::Command::new("deno")
.bin_name("deno") .bin_name("deno")
.color(ColorChoice::Never) .color(ColorChoice::Never)
// Disable clap's auto-detection of terminal width // Disable clap's auto-detection of terminal width
@ -595,20 +593,20 @@ If the flag is set, restrict these messages to errors.",
.after_help(ENV_VARIABLES_HELP) .after_help(ENV_VARIABLES_HELP)
} }
fn bench_subcommand<'a>() -> App<'a> { fn bench_subcommand<'a>() -> Command<'a> {
runtime_args(App::new("bench"), true, false) runtime_args(Command::new("bench"), true, false)
.setting(AppSettings::TrailingVarArg) .trailing_var_arg(true)
.arg( .arg(
Arg::new("ignore") Arg::new("ignore")
.long("ignore") .long("ignore")
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Ignore files"), .help("Ignore files"),
) )
.arg( .arg(
Arg::new("filter") Arg::new("filter")
.setting(ArgSettings::AllowHyphenValues) .allow_hyphen_values(true)
.long("filter") .long("filter")
.takes_value(true) .takes_value(true)
.help("Run benchmarks with this string or pattern in the bench name"), .help("Run benchmarks with this string or pattern in the bench name"),
@ -639,8 +637,8 @@ Directory arguments are expanded to all contained files matching the glob
) )
} }
fn bundle_subcommand<'a>() -> App<'a> { fn bundle_subcommand<'a>() -> Command<'a> {
compile_args(App::new("bundle")) compile_args(Command::new("bundle"))
.arg( .arg(
Arg::new("source_file") Arg::new("source_file")
.takes_value(true) .takes_value(true)
@ -667,8 +665,8 @@ If no output file is given, the output is written to standard output:
) )
} }
fn cache_subcommand<'a>() -> App<'a> { fn cache_subcommand<'a>() -> Command<'a> {
compile_args(App::new("cache")) compile_args(Command::new("cache"))
.arg( .arg(
Arg::new("file") Arg::new("file")
.takes_value(true) .takes_value(true)
@ -690,9 +688,9 @@ Future runs of this module will trigger no downloads or compilation unless
) )
} }
fn compile_subcommand<'a>() -> App<'a> { fn compile_subcommand<'a>() -> Command<'a> {
runtime_args(App::new("compile"), true, false) runtime_args(Command::new("compile"), true, false)
.setting(AppSettings::TrailingVarArg) .trailing_var_arg(true)
.arg( .arg(
script_arg().required(true), script_arg().required(true),
) )
@ -737,9 +735,9 @@ aarch64-apple-darwin target is not supported in canary.
) )
} }
fn completions_subcommand<'a>() -> App<'a> { fn completions_subcommand<'a>() -> Command<'a> {
App::new("completions") Command::new("completions")
.setting(AppSettings::DisableHelpSubcommand) .disable_help_subcommand(true)
.arg( .arg(
Arg::new("shell") Arg::new("shell")
.possible_values(&["bash", "fish", "powershell", "zsh", "fig"]) .possible_values(&["bash", "fish", "powershell", "zsh", "fig"])
@ -754,8 +752,8 @@ fn completions_subcommand<'a>() -> App<'a> {
) )
} }
fn coverage_subcommand<'a>() -> App<'a> { fn coverage_subcommand<'a>() -> Command<'a> {
App::new("coverage") Command::new("coverage")
.about("Print coverage reports") .about("Print coverage reports")
.long_about( .long_about(
"Print coverage reports from coverage profiles. "Print coverage reports from coverage profiles.
@ -794,7 +792,7 @@ Generate html reports from lcov:
Arg::new("ignore") Arg::new("ignore")
.long("ignore") .long("ignore")
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Ignore coverage files") .help("Ignore coverage files")
.value_hint(ValueHint::AnyPath), .value_hint(ValueHint::AnyPath),
@ -850,8 +848,8 @@ If no --output arg is specified then the report is written to stdout."
) )
} }
fn doc_subcommand<'a>() -> App<'a> { fn doc_subcommand<'a>() -> Command<'a> {
App::new("doc") Command::new("doc")
.about("Show documentation for a module") .about("Show documentation for a module")
.long_about( .long_about(
"Show documentation for a module. "Show documentation for a module.
@ -895,7 +893,7 @@ Show documentation for runtime built-ins:
// https://github.com/clap-rs/clap/issues/1794. Currently `--builtin` is // https://github.com/clap-rs/clap/issues/1794. Currently `--builtin` is
// just a possible value of `source_file` so leading hyphens must be // just a possible value of `source_file` so leading hyphens must be
// enabled. // enabled.
.setting(clap::AppSettings::AllowHyphenValues) .allow_hyphen_values(true)
.arg( .arg(
Arg::new("source_file") Arg::new("source_file")
.takes_value(true) .takes_value(true)
@ -910,8 +908,8 @@ Show documentation for runtime built-ins:
) )
} }
fn eval_subcommand<'a>() -> App<'a> { fn eval_subcommand<'a>() -> Command<'a> {
runtime_args(App::new("eval"), false, true) runtime_args(Command::new("eval"), false, true)
.about("Eval script") .about("Eval script")
.long_about( .long_about(
"Evaluate JavaScript from the command line. "Evaluate JavaScript from the command line.
@ -962,8 +960,8 @@ This command has implicit access to all permissions (--allow-all).",
) )
} }
fn fmt_subcommand<'a>() -> App<'a> { fn fmt_subcommand<'a>() -> Command<'a> {
App::new("fmt") Command::new("fmt")
.about("Format source files") .about("Format source files")
.long_about( .long_about(
"Auto-format JavaScript, TypeScript, Markdown, and JSON files. "Auto-format JavaScript, TypeScript, Markdown, and JSON files.
@ -1003,7 +1001,7 @@ Ignore formatting a file by adding an ignore comment at the top of the file:
Arg::new("ignore") Arg::new("ignore")
.long("ignore") .long("ignore")
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Ignore formatting particular source files") .help("Ignore formatting particular source files")
.value_hint(ValueHint::AnyPath), .value_hint(ValueHint::AnyPath),
@ -1061,8 +1059,8 @@ Ignore formatting a file by adding an ignore comment at the top of the file:
) )
} }
fn info_subcommand<'a>() -> App<'a> { fn info_subcommand<'a>() -> Command<'a> {
App::new("info") Command::new("info")
.about("Show info about cache or info related to source file") .about("Show info about cache or info related to source file")
.long_about( .long_about(
"Information about a module or the cache directories. "Information about a module or the cache directories.
@ -1103,9 +1101,9 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
) )
} }
fn install_subcommand<'a>() -> App<'a> { fn install_subcommand<'a>() -> Command<'a> {
runtime_args(App::new("install"), true, true) runtime_args(Command::new("install"), true, true)
.setting(AppSettings::TrailingVarArg) .trailing_var_arg(true)
.arg(Arg::new("cmd").required(true).multiple_values(true).value_hint(ValueHint::FilePath)) .arg(Arg::new("cmd").required(true).multiple_values(true).value_hint(ValueHint::FilePath))
.arg( .arg(
Arg::new("name") Arg::new("name")
@ -1159,9 +1157,9 @@ The installation root is determined, in order of precedence:
These must be added to the path manually if required.") These must be added to the path manually if required.")
} }
fn uninstall_subcommand<'a>() -> App<'a> { fn uninstall_subcommand<'a>() -> Command<'a> {
App::new("uninstall") Command::new("uninstall")
.setting(AppSettings::TrailingVarArg) .trailing_var_arg(true)
.arg( .arg(
Arg::new("name") Arg::new("name")
.required(true) .required(true)
@ -1190,8 +1188,8 @@ The installation root is determined, in order of precedence:
- $HOME/.deno") - $HOME/.deno")
} }
fn lsp_subcommand<'a>() -> App<'a> { fn lsp_subcommand<'a>() -> Command<'a> {
App::new("lsp") Command::new("lsp")
.about("Start the language server") .about("Start the language server")
.long_about( .long_about(
"The 'deno lsp' subcommand provides a way for code editors and IDEs to "The 'deno lsp' subcommand provides a way for code editors and IDEs to
@ -1203,8 +1201,8 @@ How to connect various editors and IDEs to 'deno lsp':
https://deno.land/manual/getting_started/setup_your_environment#editors-and-ides") https://deno.land/manual/getting_started/setup_your_environment#editors-and-ides")
} }
fn lint_subcommand<'a>() -> App<'a> { fn lint_subcommand<'a>() -> Command<'a> {
App::new("lint") Command::new("lint")
.about("Lint source files") .about("Lint source files")
.long_about( .long_about(
"Lint JavaScript/TypeScript source code. "Lint JavaScript/TypeScript source code.
@ -1244,7 +1242,7 @@ Ignore linting a file by adding an ignore comment at the top of the file:
.long("rules-tags") .long("rules-tags")
.require_equals(true) .require_equals(true)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.conflicts_with("rules") .conflicts_with("rules")
.help("Use set of rules with a tag"), .help("Use set of rules with a tag"),
) )
@ -1253,7 +1251,7 @@ Ignore linting a file by adding an ignore comment at the top of the file:
.long("rules-include") .long("rules-include")
.require_equals(true) .require_equals(true)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.conflicts_with("rules") .conflicts_with("rules")
.help("Include lint rules"), .help("Include lint rules"),
) )
@ -1262,7 +1260,7 @@ Ignore linting a file by adding an ignore comment at the top of the file:
.long("rules-exclude") .long("rules-exclude")
.require_equals(true) .require_equals(true)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.conflicts_with("rules") .conflicts_with("rules")
.help("Exclude lint rules"), .help("Exclude lint rules"),
) )
@ -1271,7 +1269,7 @@ Ignore linting a file by adding an ignore comment at the top of the file:
Arg::new("ignore") Arg::new("ignore")
.long("ignore") .long("ignore")
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Ignore linting particular source files") .help("Ignore linting particular source files")
.value_hint(ValueHint::AnyPath), .value_hint(ValueHint::AnyPath),
@ -1294,8 +1292,8 @@ Ignore linting a file by adding an ignore comment at the top of the file:
.arg(no_clear_screen_arg()) .arg(no_clear_screen_arg())
} }
fn repl_subcommand<'a>() -> App<'a> { fn repl_subcommand<'a>() -> Command<'a> {
runtime_args(App::new("repl"), false, true) runtime_args(Command::new("repl"), false, true)
.about("Read Eval Print Loop") .about("Read Eval Print Loop")
.arg( .arg(
Arg::new("eval") Arg::new("eval")
@ -1307,15 +1305,15 @@ fn repl_subcommand<'a>() -> App<'a> {
.arg(unsafely_ignore_certificate_errors_arg()) .arg(unsafely_ignore_certificate_errors_arg())
} }
fn run_subcommand<'a>() -> App<'a> { fn run_subcommand<'a>() -> Command<'a> {
runtime_args(App::new("run"), true, true) runtime_args(Command::new("run"), true, true)
.arg( .arg(
watch_arg(true) watch_arg(true)
.conflicts_with("inspect") .conflicts_with("inspect")
.conflicts_with("inspect-brk"), .conflicts_with("inspect-brk"),
) )
.arg(no_clear_screen_arg()) .arg(no_clear_screen_arg())
.setting(AppSettings::TrailingVarArg) .trailing_var_arg(true)
.arg(script_arg().required(true)) .arg(script_arg().required(true))
.about("Run a JavaScript or TypeScript program") .about("Run a JavaScript or TypeScript program")
.long_about( .long_about(
@ -1344,9 +1342,9 @@ Deno allows specifying the filename '-' to read the file from stdin.
) )
} }
fn task_subcommand<'a>() -> App<'a> { fn task_subcommand<'a>() -> Command<'a> {
App::new("task") Command::new("task")
.setting(AppSettings::TrailingVarArg) .trailing_var_arg(true)
.arg(config_arg()) .arg(config_arg())
.arg(Arg::new("task").help("Task to be executed")) .arg(Arg::new("task").help("Task to be executed"))
.arg( .arg(
@ -1363,14 +1361,14 @@ fn task_subcommand<'a>() -> App<'a> {
) )
} }
fn test_subcommand<'a>() -> App<'a> { fn test_subcommand<'a>() -> Command<'a> {
runtime_args(App::new("test"), true, true) runtime_args(Command::new("test"), true, true)
.setting(AppSettings::TrailingVarArg) .trailing_var_arg(true)
.arg( .arg(
Arg::new("ignore") Arg::new("ignore")
.long("ignore") .long("ignore")
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Ignore files") .help("Ignore files")
.value_hint(ValueHint::AnyPath), .value_hint(ValueHint::AnyPath),
@ -1416,7 +1414,7 @@ fn test_subcommand<'a>() -> App<'a> {
) )
.arg( .arg(
Arg::new("filter") Arg::new("filter")
.setting(ArgSettings::AllowHyphenValues) .allow_hyphen_values(true)
.long("filter") .long("filter")
.takes_value(true) .takes_value(true)
.help("Run tests with this string or pattern in the test name"), .help("Run tests with this string or pattern in the test name"),
@ -1489,8 +1487,8 @@ Directory arguments are expanded to all contained files matching the glob
) )
} }
fn types_subcommand<'a>() -> App<'a> { fn types_subcommand<'a>() -> Command<'a> {
App::new("types") Command::new("types")
.about("Print runtime TypeScript declarations") .about("Print runtime TypeScript declarations")
.long_about( .long_about(
"Print runtime TypeScript declarations. "Print runtime TypeScript declarations.
@ -1501,8 +1499,8 @@ The declaration file could be saved and used for typing information.",
) )
} }
fn upgrade_subcommand<'a>() -> App<'a> { fn upgrade_subcommand<'a>() -> Command<'a> {
App::new("upgrade") Command::new("upgrade")
.about("Upgrade deno executable to given version") .about("Upgrade deno executable to given version")
.long_about( .long_about(
"Upgrade deno executable to the given version. "Upgrade deno executable to the given version.
@ -1549,8 +1547,8 @@ update to a different location, use the --output flag
.arg(ca_file_arg()) .arg(ca_file_arg())
} }
fn vendor_subcommand<'a>() -> App<'a> { fn vendor_subcommand<'a>() -> Command<'a> {
App::new("vendor") Command::new("vendor")
.about("Vendor remote modules into a local directory") .about("Vendor remote modules into a local directory")
.long_about( .long_about(
"Vendor remote modules into a local directory. "Vendor remote modules into a local directory.
@ -1596,7 +1594,7 @@ Remote modules and multiple modules may also be specified:
.arg(ca_file_arg()) .arg(ca_file_arg())
} }
fn compile_args(app: App) -> App { fn compile_args(app: Command) -> Command {
app app
.arg(import_map_arg()) .arg(import_map_arg())
.arg(no_remote_arg()) .arg(no_remote_arg())
@ -1608,14 +1606,14 @@ fn compile_args(app: App) -> App {
.arg(ca_file_arg()) .arg(ca_file_arg())
} }
fn permission_args(app: App) -> App { fn permission_args(app: Command) -> Command {
app app
.arg( .arg(
Arg::new("allow-read") Arg::new("allow-read")
.long("allow-read") .long("allow-read")
.min_values(0) .min_values(0)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Allow file system read access") .help("Allow file system read access")
.value_hint(ValueHint::AnyPath), .value_hint(ValueHint::AnyPath),
@ -1625,7 +1623,7 @@ fn permission_args(app: App) -> App {
.long("allow-write") .long("allow-write")
.min_values(0) .min_values(0)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Allow file system write access") .help("Allow file system write access")
.value_hint(ValueHint::AnyPath), .value_hint(ValueHint::AnyPath),
@ -1635,7 +1633,7 @@ fn permission_args(app: App) -> App {
.long("allow-net") .long("allow-net")
.min_values(0) .min_values(0)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Allow network access") .help("Allow network access")
.validator(crate::flags_allow_net::validator), .validator(crate::flags_allow_net::validator),
@ -1646,7 +1644,7 @@ fn permission_args(app: App) -> App {
.long("allow-env") .long("allow-env")
.min_values(0) .min_values(0)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Allow environment access") .help("Allow environment access")
.validator(|keys| { .validator(|keys| {
@ -1663,7 +1661,7 @@ fn permission_args(app: App) -> App {
.long("allow-run") .long("allow-run")
.min_values(0) .min_values(0)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Allow running subprocesses"), .help("Allow running subprocesses"),
) )
@ -1672,7 +1670,7 @@ fn permission_args(app: App) -> App {
.long("allow-ffi") .long("allow-ffi")
.min_values(0) .min_values(0)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Allow loading dynamic libraries") .help("Allow loading dynamic libraries")
.value_hint(ValueHint::AnyPath), .value_hint(ValueHint::AnyPath),
@ -1698,7 +1696,11 @@ fn permission_args(app: App) -> App {
) )
} }
fn runtime_args(app: App, include_perms: bool, include_inspector: bool) -> App { fn runtime_args(
app: Command,
include_perms: bool,
include_inspector: bool,
) -> Command {
let app = compile_args(app); let app = compile_args(app);
let app = if include_perms { let app = if include_perms {
permission_args(app) permission_args(app)
@ -1719,7 +1721,7 @@ fn runtime_args(app: App, include_perms: bool, include_inspector: bool) -> App {
.arg(compat_arg()) .arg(compat_arg())
} }
fn inspect_args(app: App) -> App { fn inspect_args(app: Command) -> Command {
app app
.arg( .arg(
Arg::new("inspect") Arg::new("inspect")
@ -1768,7 +1770,7 @@ fn reload_arg<'a>() -> Arg<'a> {
.short('r') .short('r')
.min_values(0) .min_values(0)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.long("reload") .long("reload")
.help("Reload source code cache (recompile TypeScript)") .help("Reload source code cache (recompile TypeScript)")
@ -1833,7 +1835,7 @@ fn v8_flags_arg<'a>() -> Arg<'a> {
Arg::new("v8-flags") Arg::new("v8-flags")
.long("v8-flags") .long("v8-flags")
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.help("Set V8 command line options (for help: --v8-flags=--help)") .help("Set V8 command line options (for help: --v8-flags=--help)")
} }
@ -1867,7 +1869,7 @@ fn watch_arg<'a>(takes_files: bool) -> Arg<'a> {
.value_name("FILES") .value_name("FILES")
.min_values(0) .min_values(0)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.long_help( .long_help(
"UNSTABLE: Watch for file changes and restart process automatically. "UNSTABLE: Watch for file changes and restart process automatically.
@ -1968,7 +1970,7 @@ fn unsafely_ignore_certificate_errors_arg<'a>() -> Arg<'a> {
.long("unsafely-ignore-certificate-errors") .long("unsafely-ignore-certificate-errors")
.min_values(0) .min_values(0)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_equals(true) .require_equals(true)
.value_name("HOSTNAMES") .value_name("HOSTNAMES")
.help("DANGER: Disables verification of TLS certificates") .help("DANGER: Disables verification of TLS certificates")
@ -2075,7 +2077,7 @@ fn compile_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
fn completions_parse( fn completions_parse(
flags: &mut Flags, flags: &mut Flags,
matches: &clap::ArgMatches, matches: &clap::ArgMatches,
mut app: clap::App, mut app: clap::Command,
) { ) {
use clap_complete::generate; use clap_complete::generate;
use clap_complete::shells::{Bash, Fish, PowerShell, Zsh}; use clap_complete::shells::{Bash, Fish, PowerShell, Zsh};
@ -2845,9 +2847,9 @@ mod tests {
#[test] #[test]
fn version() { fn version() {
let r = flags_from_vec(svec!["deno", "--version"]); let r = flags_from_vec(svec!["deno", "--version"]);
assert_eq!(r.unwrap_err().kind, clap::ErrorKind::DisplayVersion); assert_eq!(r.unwrap_err().kind(), clap::ErrorKind::DisplayVersion);
let r = flags_from_vec(svec!["deno", "-V"]); let r = flags_from_vec(svec!["deno", "-V"]);
assert_eq!(r.unwrap_err().kind, clap::ErrorKind::DisplayVersion); assert_eq!(r.unwrap_err().kind(), clap::ErrorKind::DisplayVersion);
} }
#[test] #[test]
@ -5197,7 +5199,7 @@ mod tests {
let error_message = r.unwrap_err().to_string(); let error_message = r.unwrap_err().to_string();
assert!(&error_message assert!(&error_message
.contains("error: The following required arguments were not provided:")); .contains("error: The following required arguments were not provided:"));
assert!(&error_message.contains("--watch=<FILES>...")); assert!(&error_message.contains("--watch[=<FILES>...]"));
} }
#[test] #[test]

View file

@ -1469,8 +1469,8 @@ pub fn main() {
let flags = match flags::flags_from_vec(args) { let flags = match flags::flags_from_vec(args) {
Ok(flags) => flags, Ok(flags) => flags,
Err(err @ clap::Error { .. }) Err(err @ clap::Error { .. })
if err.kind == clap::ErrorKind::DisplayHelp if err.kind() == clap::ErrorKind::DisplayHelp
|| err.kind == clap::ErrorKind::DisplayVersion => || err.kind() == clap::ErrorKind::DisplayVersion =>
{ {
err.print().unwrap(); err.print().unwrap();
std::process::exit(0); std::process::exit(0);