cli: Error out if we wrongly pass a <patch-id>

It was previously possible to call `rad patch open` with a patch-id
and get no error. This fixes it.
This commit is contained in:
Alexis Sellier
2023-04-22 13:57:58 +02:00
parent bf8653b6c2
commit 2ff5ad97f3
+9 -1
View File
@@ -202,7 +202,15 @@ impl Args for Options {
unknown => anyhow::bail!("unknown operation '{}'", unknown),
},
Value(val)
if op.is_some() && op != Some(OperationName::List) && patch_id.is_none() =>
if patch_id.is_none()
&& [
Some(OperationName::Show),
Some(OperationName::Update),
Some(OperationName::Delete),
Some(OperationName::Archive),
Some(OperationName::Checkout),
]
.contains(&op) =>
{
let val = string(&val);
patch_id = Some(Rev::from(val));