Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions crates/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,4 +472,41 @@ mod tests {
other => panic!("expected bucket command, got {:?}", other),
}
}

#[test]
fn cli_accepts_rm_purge_flag() {
let cli = Cli::try_parse_from(["rc", "rm", "local/my-bucket/object.txt", "--purge"])
.expect("parse rm purge");

match cli.command {
Commands::Rm(arg) => {
assert_eq!(arg.paths, vec!["local/my-bucket/object.txt"]);
assert!(arg.purge);
}
other => panic!("expected rm command, got {:?}", other),
}
}

#[test]
fn cli_accepts_object_remove_purge_flag() {
let cli = Cli::try_parse_from([
"rc",
"object",
"remove",
"local/my-bucket/object.txt",
"--purge",
])
.expect("parse object remove purge");

match cli.command {
Commands::Object(args) => match args.command {
object::ObjectCommands::Remove(arg) => {
assert_eq!(arg.paths, vec!["local/my-bucket/object.txt"]);
assert!(arg.purge);
}
other => panic!("expected object remove command, got {:?}", other),
},
other => panic!("expected object command, got {:?}", other),
}
}
}