fix(cli): uninstall command accept short flags (#17259)

This commit is contained in:
Doni Rubiagatra 2023-01-06 09:09:39 +07:00 committed by GitHub
parent 896dd56b7a
commit 39cbaa6d34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1312,8 +1312,7 @@ fn uninstall_subcommand<'a>() -> Command<'a> {
.arg(
Arg::new("name")
.required(true)
.multiple_occurrences(false)
.allow_hyphen_values(true))
.multiple_occurrences(false))
.arg(
Arg::new("root")
.long("root")
@ -5004,6 +5003,27 @@ mod tests {
);
}
#[test]
fn uninstall() {
let r = flags_from_vec(svec!["deno", "uninstall", "file_server"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Uninstall(UninstallFlags {
name: "file_server".to_string(),
root: None,
}),
..Flags::default()
}
);
}
#[test]
fn uninstall_with_help_flag() {
let r = flags_from_vec(svec!["deno", "uninstall", "--help"]);
assert_eq!(r.err().unwrap().kind(), clap::ErrorKind::DisplayHelp);
}
#[test]
fn log_level() {
let r =