diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-08-07 21:46:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-07 16:46:54 -0400 |
commit | 479164d287604d079f6342e656f2ac95b109367f (patch) | |
tree | 2c07383a1f4f5b666dfab28acf7d238d20822376 /cli/flags.rs | |
parent | 41215eb29c50cdf7048f7431076ccc986b514f6d (diff) |
fix(deno info): Never type check (#6978)
Diffstat (limited to 'cli/flags.rs')
-rw-r--r-- | cli/flags.rs | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index 80eeba217..ee85efbe9 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -468,7 +468,7 @@ fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) { ca_file_arg_parse(flags, matches); unstable_arg_parse(flags, matches); let json = matches.is_present("json"); - no_check_arg_parse(flags, matches); + flags.no_check = true; flags.subcommand = DenoSubcommand::Info { file: matches.value_of("file").map(|f| f.to_string()), json, @@ -849,7 +849,10 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.", ) .arg(Arg::with_name("file").takes_value(true).required(false)) .arg(ca_file_arg()) - .arg(no_check_arg()) + // TODO(nayeemrmn): `--no-check` has been removed for `deno info`, but it + // shouldn't cause flag parsing to fail for backward-compatibility. Remove + // this line for v2.0.0. + .arg(no_check_arg().hidden(true)) .arg(unstable_arg()) .arg( Arg::with_name("json") @@ -1832,6 +1835,7 @@ mod tests { json: false, file: Some("script.ts".to_string()), }, + no_check: true, ..Flags::default() } ); @@ -1844,6 +1848,7 @@ mod tests { json: true, file: Some("script.ts".to_string()), }, + no_check: true, ..Flags::default() } ); @@ -1856,6 +1861,7 @@ mod tests { json: false, file: None }, + no_check: true, ..Flags::default() } ); @@ -1868,6 +1874,7 @@ mod tests { json: true, file: None }, + no_check: true, ..Flags::default() } ); @@ -2573,6 +2580,50 @@ mod tests { ..Flags::default() } ); + let r = + flags_from_vec_safe(svec!["deno", "test", "--no-check", "script.ts"]); + assert_eq!( + r.unwrap(), + Flags { + subcommand: DenoSubcommand::Test { + fail_fast: false, + filter: None, + allow_none: false, + quiet: false, + include: Some(svec!["script.ts"]), + }, + no_check: true, + ..Flags::default() + } + ); + let r = + flags_from_vec_safe(svec!["deno", "cache", "--no-check", "script.ts"]); + assert_eq!( + r.unwrap(), + Flags { + subcommand: DenoSubcommand::Cache { + files: svec!["script.ts"], + }, + no_check: true, + ..Flags::default() + } + ); + // TODO(nayeemrmn): `--no-check` has been removed for `deno info`, but it + // shouldn't cause flag parsing to fail for backward-compatibility. Remove + // this test for v2.0.0. + let r = + flags_from_vec_safe(svec!["deno", "info", "--no-check", "script.ts"]); + assert_eq!( + r.unwrap(), + Flags { + subcommand: DenoSubcommand::Info { + json: false, + file: Some("script.ts".to_string()), + }, + no_check: true, + ..Flags::default() + } + ); } #[test] @@ -2893,6 +2944,7 @@ mod tests { file: Some("https://example.com".to_string()), }, ca_file: Some("example.crt".to_owned()), + no_check: true, ..Flags::default() } ); |