refactor: move projects list into separate file
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -3,6 +3,7 @@ use crate::{
|
||||
git_provider::{
|
||||
gitea::GiteaProviderApp, github::GitHubProviderApp, GitProvider, VecRepositoryExt,
|
||||
},
|
||||
projects_list::ProjectsListApp,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -19,38 +20,9 @@ impl RootCommand {
|
||||
pub async fn execute(&mut self) -> anyhow::Result<()> {
|
||||
tracing::debug!("executing");
|
||||
|
||||
let repositories = self.app.projects_list().get_projects().await?;
|
||||
|
||||
//let github_provider = self.app.github_provider();
|
||||
let gitea_provider = self.app.gitea_provider();
|
||||
|
||||
let mut repositories = Vec::new();
|
||||
for gitea in self.app.config.providers.gitea.iter() {
|
||||
if let Some(user) = &gitea.current_user {
|
||||
let mut repos = gitea_provider
|
||||
.list_repositories_for_current_user(
|
||||
user,
|
||||
&gitea.url,
|
||||
gitea.access_token.as_ref(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
repositories.append(&mut repos);
|
||||
}
|
||||
|
||||
for gitea_user in gitea.users.iter() {
|
||||
let mut repos = gitea_provider
|
||||
.list_repositories_for_user(
|
||||
gitea_user.into(),
|
||||
&gitea.url,
|
||||
gitea.access_token.as_ref(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
repositories.append(&mut repos);
|
||||
}
|
||||
}
|
||||
|
||||
repositories.collect_unique();
|
||||
|
||||
for repo in &repositories {
|
||||
tracing::info!("repo: {}", repo.to_rel_path().display());
|
||||
}
|
||||
|
Reference in New Issue
Block a user