diff --git a/crates/cuddle/src/cli.rs b/crates/cuddle/src/cli.rs index 33a3dea..51a746a 100644 --- a/crates/cuddle/src/cli.rs +++ b/crates/cuddle/src/cli.rs @@ -54,6 +54,10 @@ impl Cli { tracing::debug!("executing do"); } ("get", args) => { + if !self.cuddle.has_project() { + anyhow::bail!("get is not available without a project"); + } + let query = args .get_one::("query") .ok_or(anyhow!("query is required"))?; diff --git a/crates/cuddle/src/cuddle_state.rs b/crates/cuddle/src/cuddle_state.rs index 10b8eeb..460aa9d 100644 --- a/crates/cuddle/src/cuddle_state.rs +++ b/crates/cuddle/src/cuddle_state.rs @@ -66,3 +66,17 @@ impl Cuddle { Ok(Cuddle { state }) } } + +impl Cuddle { + pub fn has_project(&self) -> bool { + if self.state.project.is_some() { + return true; + } + + if self.state.plan.is_some() { + return true; + } + + false + } +}