Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli) error gracefully when script arg is not present and `--v8-fl…
…ags` is present in `deno run` (#20145) Fix #20022, fix #19627 (duplicate) #17333 upgraded clap from version 3.1 to version 4. clap version 3.2.0 (intentionally) broke a behavior that deno was relying on to make `deno run --v8-flags=--help` work without specifying a file, see clap-rs/clap#3793. The workaround was to make the script argument required _unless_ `--v8-flags` is present. This broke the expectation that all successfully parsed `run` commands have the script argument set, leading to the panic on `matches.remove_many::<String>("script_arg").unwrap()`. Clap, as far as I was able to find out, does not currently offer a neat solution to this problem. This PR adds logic to create and return a custom clap error when a parsed run command does not have the script argument. I added an appropriate test.
- Loading branch information