From e4af513ce7ad6ae0cb09e919367528099eac048d Mon Sep 17 00:00:00 2001 From: Vladimir Bauer Date: Wed, 13 Nov 2024 23:26:18 +0500 Subject: [PATCH] edit: return early if prereq is not met --- src/kamp/cmd/edit.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kamp/cmd/edit.rs b/src/kamp/cmd/edit.rs index 326594b..039beba 100644 --- a/src/kamp/cmd/edit.rs +++ b/src/kamp/cmd/edit.rs @@ -4,6 +4,9 @@ use std::path::PathBuf; use super::{Context, Error, Result}; pub(crate) fn edit(ctx: Context, focus: bool, files: Vec) -> Result { + if focus && ctx.is_draft() { + return Err(anyhow::Error::msg("no client in context").into()); + } let mut buf = String::new(); let mut pair = [None; 2]; let mut coord = None; @@ -57,8 +60,6 @@ pub(crate) fn edit(ctx: Context, focus: bool, files: Vec) -> Result