chore: cleanup before get
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
b3aedfb411
commit
23d68caf71
@ -37,19 +37,15 @@ impl Cli {
|
||||
Self { cli, cuddle }
|
||||
}
|
||||
|
||||
pub async fn setup(self) -> anyhow::Result<Self> {
|
||||
let s = self
|
||||
.add_default()
|
||||
.await?
|
||||
.add_project_commands()
|
||||
.await?
|
||||
.add_plan_commands()
|
||||
.await?;
|
||||
pub async fn setup(mut self) -> anyhow::Result<Self> {
|
||||
let commands = self.get_commands().await?;
|
||||
|
||||
self.cli = self.cli.subcommands(commands);
|
||||
|
||||
// TODO: Add global
|
||||
// TODO: Add components
|
||||
|
||||
Ok(s)
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
pub async fn execute(self) -> anyhow::Result<()> {
|
||||
@ -69,21 +65,20 @@ impl Cli {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn add_default(mut self) -> anyhow::Result<Self> {
|
||||
self.cli = self
|
||||
.cli
|
||||
.subcommand(clap::Command::new("do").alias("x"))
|
||||
.subcommand(clap::Command::new("get"));
|
||||
|
||||
Ok(self)
|
||||
async fn get_commands(&self) -> anyhow::Result<Vec<clap::Command>> {
|
||||
Ok(vec![
|
||||
clap::Command::new("do").subcommand_required(true),
|
||||
clap::Command::new("get"),
|
||||
])
|
||||
}
|
||||
|
||||
async fn add_project_commands(self) -> anyhow::Result<Self> {
|
||||
async fn add_project_commands(&self) -> anyhow::Result<Vec<clap::Command>> {
|
||||
if let Some(_project) = self.cuddle.state.project.as_ref() {
|
||||
// Add project level commands
|
||||
return Ok(vec![]);
|
||||
}
|
||||
|
||||
Ok(self)
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
async fn add_plan_commands(self) -> anyhow::Result<Self> {
|
||||
|
Loading…
Reference in New Issue
Block a user