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-21 14:31:07 +02:00
parent bf8653b6c2
commit 2ff5ad97f3
No known key found for this signature in database
1 changed files with 9 additions and 1 deletions

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));