1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

feat: deno info --reload (#7009)

This commit is contained in:
Nayeem Rahman 2020-08-12 11:58:50 +01:00 committed by GitHub
parent 91ff91093d
commit fed70c9903
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -465,6 +465,7 @@ fn eval_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
} }
fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) { fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
reload_arg_parse(flags, matches);
ca_file_arg_parse(flags, matches); ca_file_arg_parse(flags, matches);
unstable_arg_parse(flags, matches); unstable_arg_parse(flags, matches);
let json = matches.is_present("json"); let json = matches.is_present("json");
@ -848,6 +849,7 @@ Remote modules cache: Subdirectory containing downloaded remote modules.
TypeScript compiler cache: Subdirectory containing TS compiler output.", TypeScript compiler cache: Subdirectory containing TS compiler output.",
) )
.arg(Arg::with_name("file").takes_value(true).required(false)) .arg(Arg::with_name("file").takes_value(true).required(false))
.arg(reload_arg().requires("file"))
.arg(ca_file_arg()) .arg(ca_file_arg())
// TODO(nayeemrmn): `--no-check` has been removed for `deno info`, but it // TODO(nayeemrmn): `--no-check` has been removed for `deno info`, but it
// shouldn't cause flag parsing to fail for backward-compatibility. Remove // shouldn't cause flag parsing to fail for backward-compatibility. Remove
@ -1840,6 +1842,20 @@ mod tests {
} }
); );
let r = flags_from_vec_safe(svec!["deno", "info", "--reload", "script.ts"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Info {
json: false,
file: Some("script.ts".to_string()),
},
reload: true,
no_check: true,
..Flags::default()
}
);
let r = flags_from_vec_safe(svec!["deno", "info", "--json", "script.ts"]); let r = flags_from_vec_safe(svec!["deno", "info", "--json", "script.ts"]);
assert_eq!( assert_eq!(
r.unwrap(), r.unwrap(),