1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix(cli): add config flag to deno info (#14706)

This commit is contained in:
Mark Ladyshau 2022-06-13 20:09:04 +02:00 committed by GitHub
parent 64abb65f05
commit decdc59071
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 0 deletions

View file

@ -1196,6 +1196,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
)
// TODO(lucacasonato): remove for 2.0
.arg(no_check_arg().hide(true))
.args(config_args())
.arg(import_map_arg())
.arg(
Arg::new("json")
@ -2438,6 +2439,7 @@ fn fmt_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
reload_arg_parse(flags, matches);
config_args_parse(flags, matches);
import_map_arg_parse(flags, matches);
location_arg_parse(flags, matches);
ca_file_arg_parse(flags, matches);
@ -3862,6 +3864,19 @@ mod tests {
..Flags::default()
}
);
let r = flags_from_vec(svec!["deno", "info", "--config", "tsconfig.json"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Info(InfoFlags {
json: false,
file: None
}),
config_flag: ConfigFlag::Path("tsconfig.json".to_owned()),
..Flags::default()
}
);
}
#[test]

View file

@ -124,3 +124,8 @@ itest!(deno_info_types_header_direct {
output: "info/types_header.out",
http_server: true,
});
itest!(deno_info_with_config_override {
args: "info info/with_config/test.ts --config info/with_config/deno-override.json --import-map info/with_config/import_map.json",
output: "info/with_config/with_config.out",
});

View file

@ -0,0 +1,3 @@
{
"importMap": "import_map.json"
}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
console.log("foo");

View file

@ -0,0 +1,6 @@
Warning the configuration file "[WILDCARD]/deno-override.json" contains an entry for "importMap" that is being ignored.
local: [WILDCARD]test.ts
type: TypeScript
dependencies: 0 unique (total [WILDCARD])
file:///[WILDCARD]/test.ts ([WILDCARD])