mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 08:09:08 -05:00
make importmap flag global (#2687)
This commit is contained in:
parent
89e6792203
commit
729c4e9377
3 changed files with 30 additions and 10 deletions
38
cli/flags.rs
38
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),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -168,6 +158,18 @@ To get help on the another subcommands (run in this case):
|
|||
.help("Load compiler configuration file")
|
||||
.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")
|
||||
|
@ -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]
|
||||
|
|
0
tests/036_import_map_fetch.out
Normal file
0
tests/036_import_map_fetch.out
Normal file
2
tests/036_import_map_fetch.test
Normal file
2
tests/036_import_map_fetch.test
Normal file
|
@ -0,0 +1,2 @@
|
|||
args: fetch --reload --importmap=tests/importmaps/import_map.json tests/importmaps/test.ts
|
||||
output: tests/036_import_map_fetch.out
|
Loading…
Reference in a new issue