feat: add cache
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-09-14 20:45:49 +02:00
parent 1cc771be1e
commit 6c94f02428
11 changed files with 416 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
use crate::{ app::App, projects_list::ProjectsListApp};
use crate::{app::App, cache::CacheApp, projects_list::ProjectsListApp};
#[derive(Debug, Clone)]
pub struct RootCommand {
@@ -14,7 +14,16 @@ impl RootCommand {
pub async fn execute(&mut self) -> anyhow::Result<()> {
tracing::debug!("executing");
let repositories = self.app.projects_list().get_projects().await?;
let repositories = match self.app.cache().get().await? {
Some(repos) => repos,
None => {
let repositories = self.app.projects_list().get_projects().await?;
self.app.cache().update(&repositories).await?;
repositories
}
};
for repo in &repositories {
tracing::info!("repo: {}", repo.to_rel_path().display());