diff options
Diffstat (limited to 'cli/flags.rs')
-rw-r--r-- | cli/flags.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index 4cacb01e4..eb98c6032 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -106,6 +106,7 @@ pub struct Flags { pub lock_write: bool, pub log_level: Option<Level>, pub net_allowlist: Vec<String>, + pub no_check: bool, pub no_prompts: bool, pub no_remote: bool, pub read_allowlist: Vec<PathBuf>, @@ -453,6 +454,7 @@ fn eval_parse(flags: &mut Flags, matches: &clap::ArgMatches) { fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) { ca_file_arg_parse(flags, matches); unstable_arg_parse(flags, matches); + no_check_arg_parse(flags, matches); flags.subcommand = DenoSubcommand::Info { file: matches.value_of("file").map(|f| f.to_string()), @@ -464,6 +466,7 @@ fn cache_parse(flags: &mut Flags, matches: &clap::ArgMatches) { lock_args_parse(flags, matches); importmap_arg_parse(flags, matches); config_arg_parse(flags, matches); + no_check_arg_parse(flags, matches); no_remote_arg_parse(flags, matches); ca_file_arg_parse(flags, matches); unstable_arg_parse(flags, matches); @@ -492,6 +495,7 @@ fn run_test_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) { importmap_arg_parse(flags, matches); config_arg_parse(flags, matches); v8_flags_arg_parse(flags, matches); + no_check_arg_parse(flags, matches); no_remote_arg_parse(flags, matches); permission_args_parse(flags, matches); ca_file_arg_parse(flags, matches); @@ -818,6 +822,7 @@ 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()) .arg(unstable_arg()) } @@ -829,6 +834,7 @@ fn cache_subcommand<'a, 'b>() -> App<'a, 'b> { .arg(importmap_arg()) .arg(unstable_arg()) .arg(config_arg()) + .arg(no_check_arg()) .arg(no_remote_arg()) .arg( Arg::with_name("file") @@ -1040,6 +1046,7 @@ fn run_test_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> { .arg(config_arg()) .arg(lock_arg()) .arg(lock_write_arg()) + .arg(no_check_arg()) .arg(no_remote_arg()) .arg(v8_flags_arg()) .arg(ca_file_arg()) @@ -1314,6 +1321,18 @@ fn v8_flags_arg_parse(flags: &mut Flags, matches: &ArgMatches) { } } +fn no_check_arg<'a, 'b>() -> Arg<'a, 'b> { + Arg::with_name("no-check") + .long("no-check") + .help("Skip type checking modules") +} + +fn no_check_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) { + if matches.is_present("no-check") { + flags.no_check = true; + } +} + fn no_remote_arg<'a, 'b>() -> Arg<'a, 'b> { Arg::with_name("no-remote") .long("no-remote") @@ -2442,6 +2461,22 @@ mod tests { */ #[test] + fn no_check() { + let r = + flags_from_vec_safe(svec!["deno", "run", "--no-check", "script.ts"]); + assert_eq!( + r.unwrap(), + Flags { + subcommand: DenoSubcommand::Run { + script: "script.ts".to_string(), + }, + no_check: true, + ..Flags::default() + } + ); + } + + #[test] fn no_remote() { let r = flags_from_vec_safe(svec!["deno", "run", "--no-remote", "script.ts"]); |