fix(cli/org): reject --file on non-Document org edit (fail fast)
This commit is contained in:
@@ -1015,6 +1015,9 @@ pub fn run_edit(dir: &Path, query: &str, totp_qr: Option<std::path::PathBuf>, fi
|
|||||||
crate::org_session::UnlockedOrgVault::ensure_grant(&caller, &collection)?;
|
crate::org_session::UnlockedOrgVault::ensure_grant(&caller, &collection)?;
|
||||||
|
|
||||||
let mut item = vault.load_item(&collection, &id)?;
|
let mut item = vault.load_item(&collection, &id)?;
|
||||||
|
if file.is_some() && !matches!(item.core, ItemCore::Document(_)) {
|
||||||
|
anyhow::bail!("--file is only valid when editing a Document item");
|
||||||
|
}
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"Editing: {} ({}) — leave a prompt blank to keep the current value.",
|
"Editing: {} ({}) — leave a prompt blank to keep the current value.",
|
||||||
item.title,
|
item.title,
|
||||||
|
|||||||
Reference in New Issue
Block a user