diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-07-27 16:37:03 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-27 14:37:03 +0000 |
commit | 729c4e9377c2112d51cefb6eb0c723cbaf2a1ff5 (patch) | |
tree | d57f2fceb361502ab334f9f7da48446319e38566 /cli/flags.rs | |
parent | 89e6792203678a2ae4911e006fcf9b26f63c700d (diff) |
make importmap flag global (#2687)
Diffstat (limited to 'cli/flags.rs')
-rw-r--r-- | cli/flags.rs | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index ad08b5a7a..978b0409f 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -100,16 +100,6 @@ fn add_run_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> { Arg::with_name("no-fetch") .long("no-fetch") .help("Do not download remote modules"), - ).arg( - Arg::with_name("importmap") - .long("importmap") - .value_name("FILE") - .help("Load import map file") - .long_help( - "Load import map file -Specification: https://wicg.github.io/import-maps/ -Examples: https://github.com/WICG/import-maps#the-import-map", - ).takes_value(true), ) } @@ -169,6 +159,18 @@ To get help on the another subcommands (run in this case): .takes_value(true) .global(true), ).arg( + Arg::with_name("importmap") + .long("importmap") + .value_name("FILE") + .help("Load import map file") + .long_help( + "Load import map file +Specification: https://wicg.github.io/import-maps/ +Examples: https://github.com/WICG/import-maps#the-import-map", + ) + .takes_value(true) + .global(true), + ).arg( Arg::with_name("seed") .long("seed") .value_name("NUMBER") @@ -1368,6 +1370,22 @@ mod tests { ); assert_eq!(subcommand, DenoSubcommand::Run); assert_eq!(argv, svec!["deno", "script.ts"]); + + let (flags, subcommand, argv) = flags_from_vec(svec![ + "deno", + "fetch", + "--importmap=importmap.json", + "script.ts" + ]); + assert_eq!( + flags, + DenoFlags { + import_map_path: Some("importmap.json".to_owned()), + ..DenoFlags::default() + } + ); + assert_eq!(subcommand, DenoSubcommand::Fetch); + assert_eq!(argv, svec!["deno", "script.ts"]); } #[test] |