Add flag to remove accepted version from PO
Adds a flag to remove the currently accepted version ID from a PO.
Previously, users would have to set the accepted version ID to an
empty string, which will be unituitive after these commits.
@@ -1681,6 +1681,11 @@ fn run() -> Result<(), CliError> {
.long("set-accepted-version")
.help("Set the supplied version ID as the accepted Purchase Order version"),
)
+ .arg(
+ Arg::with_name("rm_accepted_version")
+ .long("rm-accepted-version")
+ .help("Unset the Purchase Order's current accepted version ID")
+ )
.arg(
Arg::with_name("version_id")
.value_name("version-id")
@@ -2595,6 +2600,14 @@ fn run() -> Result<(), CliError> {
is_closed = true;
}
+ if m.is_present("set_accepted_version") & m.is_present("rm_accepted_version") {
+ return Err(CliError::UserError(
+ "Both set and remove accepted version flags were supplied; \
+ only one of these operations is allowed at a time"
+ .to_string(),
+ ));
+ }
+
let mut accepted_version = po.accepted_version_id;
if m.is_present("set_accepted_version") {
match m.value_of("version_id") {
@@ -2608,6 +2621,10 @@ fn run() -> Result<(), CliError> {
}
}
+ if m.is_present("rm_accepted_version") {
+ accepted_version = Some(String::from(""));
+ }
+
let mut alternate_ids = po.alternate_ids.clone();
if m.is_present("add_id") {
