feat: get only in projects
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
d33e42a608
commit
dfa70b3485
@ -54,6 +54,10 @@ impl Cli {
|
|||||||
tracing::debug!("executing do");
|
tracing::debug!("executing do");
|
||||||
}
|
}
|
||||||
("get", args) => {
|
("get", args) => {
|
||||||
|
if !self.cuddle.has_project() {
|
||||||
|
anyhow::bail!("get is not available without a project");
|
||||||
|
}
|
||||||
|
|
||||||
let query = args
|
let query = args
|
||||||
.get_one::<String>("query")
|
.get_one::<String>("query")
|
||||||
.ok_or(anyhow!("query is required"))?;
|
.ok_or(anyhow!("query is required"))?;
|
||||||
|
@ -66,3 +66,17 @@ impl Cuddle<PreparePlan> {
|
|||||||
Ok(Cuddle { state })
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user