diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-11-03 18:06:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-03 17:06:18 +0000 |
commit | ee1e9a6434d4808b455a1b23b88784c152a2af97 (patch) | |
tree | f3278935deac88a8ad5c060ae79e2ecb2e2609f9 | |
parent | 76fbe85264eda4abf9b17f6ec915fdc6ea8c24b0 (diff) |
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
-rw-r--r-- | cli/args/flags.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index fa1534e0c..82a536e47 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", |