From ee1e9a6434d4808b455a1b23b88784c152a2af97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 3 Nov 2023 18:06:18 +0100 Subject: [PATCH] fix(doc): require source files if --html or --lint used (#21072) Fixes https://github.com/denoland/deno/issues/21067 Fixes https://github.com/denoland/deno/issues/21070 --- cli/args/flags.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cli/args/flags.rs b/cli/args/flags.rs index fa1534e0c7..82a536e476 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -1480,7 +1480,8 @@ Show documentation for runtime built-ins: Arg::new("source_file") .num_args(1..) .action(ArgAction::Append) - .value_hint(ValueHint::FilePath), + .value_hint(ValueHint::FilePath) + .required_if_eq_any([("html", "true"), ("lint", "true")]), ) }) } @@ -7541,6 +7542,10 @@ mod tests { } ); + let r = + flags_from_vec(svec!["deno", "doc", "--html", "--name=My library",]); + assert!(r.is_err()); + let r = flags_from_vec(svec![ "deno", "doc", @@ -7677,6 +7682,9 @@ mod tests { } ); + let r = flags_from_vec(svec!["deno", "doc", "--lint",]); + assert!(r.is_err()); + let r = flags_from_vec(svec![ "deno", "doc",