diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-07-20 15:19:06 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-20 09:19:06 -0400 |
commit | 34f212f257af3ccce4a1cb8e9b75b9cb5cb1c13b (patch) | |
tree | 81ed74790a22b2d665a4b70ae0c3fe4d07cd61bd /cli/flags.rs | |
parent | a00d087b39da7894276c2292335d2709a6cebd8c (diff) |
fix: bring back --no-fetch flag (#2671)
Diffstat (limited to 'cli/flags.rs')
-rw-r--r-- | cli/flags.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index a666ffe67..535ed500a 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -97,6 +97,10 @@ fn add_run_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> { .long("no-prompt") .help("Do not use prompts"), ).arg( + Arg::with_name("no-fetch") + .long("no-fetch") + .help("Do not download remote modules"), + ).arg( Arg::with_name("importmap") .long("importmap") .value_name("FILE") @@ -552,6 +556,9 @@ fn parse_run_args(mut flags: DenoFlags, matches: &ArgMatches) -> DenoFlags { if matches.is_present("no-prompt") { flags.no_prompts = true; } + if matches.is_present("no-fetch") { + flags.no_fetch = true; + } flags.import_map_path = matches.value_of("importmap").map(ToOwned::to_owned); flags @@ -1560,4 +1567,19 @@ mod tests { assert_eq!(subcommand, DenoSubcommand::Run); assert_eq!(argv, svec!["deno", "script.ts", "-", "foo", "bar"]); } + + #[test] + fn test_flags_from_vec_34() { + let (flags, subcommand, argv) = + flags_from_vec(svec!["deno", "--no-fetch", "script.ts"]); + assert_eq!( + flags, + DenoFlags { + no_fetch: true, + ..DenoFlags::default() + } + ); + assert_eq!(subcommand, DenoSubcommand::Run); + assert_eq!(argv, svec!["deno", "script.ts"]) + } } |