@@ -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::<String>("query")
|
||||
.ok_or(anyhow!("query is required"))?;
|
||||
|
@@ -66,3 +66,17 @@ impl Cuddle<PreparePlan> {
|
||||
Ok(Cuddle { state })
|
||||
}
|
||||
}
|
||||
|
||||
impl Cuddle<ValidatedState> {
|
||||
pub fn has_project(&self) -> bool {
|
||||
if self.state.project.is_some() {
|
||||
return true;
|
||||
}
|
||||
|
||||
if self.state.plan.is_some() {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user