summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-12-07 13:33:26 -0500
committerGitHub <noreply@github.com>2022-12-07 13:33:26 -0500
commit192f07bb7e2076808cae1eeb6c701cdd3d8d42cd (patch)
tree68fb735a3b0b09295fb841e59018cbd0f418ab91 /cli/args/flags.rs
parent9c1ab39e19073501618947ffa370ba59b04ec6cc (diff)
feat(flags): add `deno check --all` as new preferred alias for `--remote` (#16702)
Closes #16374
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r--cli/args/flags.rs62
1 files changed, 36 insertions, 26 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 829051bce..4296fbc77 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -797,13 +797,21 @@ Future runs of this module will trigger no downloads or compilation unless \
fn check_subcommand<'a>() -> Command<'a> {
compile_args_without_check_args(Command::new("check"))
- .arg(
- Arg::new("remote")
- .long("remote")
- .help("Type-check all modules, including remote")
- .conflicts_with("no-remote")
+ .arg(
+ Arg::new("all")
+ .long("all")
+ .help("Type-check all code, including remote modules and npm packages")
+ .conflicts_with("no-remote")
)
.arg(
+ // past alias for --all
+ Arg::new("remote")
+ .long("remote")
+ .help("Type-check all modules, including remote")
+ .conflicts_with("no-remote")
+ .hide(true)
+ )
+ .arg(
Arg::new("file")
.takes_value(true)
.required(true)
@@ -2343,7 +2351,7 @@ fn check_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
.unwrap()
.map(String::from)
.collect();
- if matches.is_present("remote") {
+ if matches.is_present("all") || matches.is_present("remote") {
flags.type_check_mode = TypeCheckMode::All;
}
flags.subcommand = DenoSubcommand::Check(CheckFlags { files });
@@ -4001,26 +4009,28 @@ mod tests {
}
);
- let r = flags_from_vec(svec!["deno", "check", "--remote", "script.ts"]);
- assert_eq!(
- r.unwrap(),
- Flags {
- subcommand: DenoSubcommand::Check(CheckFlags {
- files: svec!["script.ts"],
- }),
- type_check_mode: TypeCheckMode::All,
- ..Flags::default()
- }
- );
-
- let r = flags_from_vec(svec![
- "deno",
- "check",
- "--remote",
- "--no-remote",
- "script.ts"
- ]);
- assert_eq!(r.unwrap_err().kind(), clap::ErrorKind::ArgumentConflict);
+ for all_flag in ["--remote", "--all"] {
+ let r = flags_from_vec(svec!["deno", "check", all_flag, "script.ts"]);
+ assert_eq!(
+ r.unwrap(),
+ Flags {
+ subcommand: DenoSubcommand::Check(CheckFlags {
+ files: svec!["script.ts"],
+ }),
+ type_check_mode: TypeCheckMode::All,
+ ..Flags::default()
+ }
+ );
+
+ let r = flags_from_vec(svec![
+ "deno",
+ "check",
+ all_flag,
+ "--no-remote",
+ "script.ts"
+ ]);
+ assert_eq!(r.unwrap_err().kind(), clap::ErrorKind::ArgumentConflict);
+ }
}
#[test]