commands/list: init
This commit is contained in:
+11
-36
@@ -4,8 +4,16 @@ pub mod gitea;
|
||||
pub mod github;
|
||||
pub mod gitlab;
|
||||
|
||||
// pub use forgejo::KagamiSourceForgejo;
|
||||
pub use git::KagamiSourceGit;
|
||||
pub use gitea::KagamiSourceGitea;
|
||||
pub use github::KagamiSourceGithub;
|
||||
// pub use gitlab::KagamiSourceGitLab;
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use crate::config::RepositoryFilterConfig;
|
||||
|
||||
pub trait KagamiSource {
|
||||
const NAME: &'static str;
|
||||
const DEFAULT_HOST: &'static str;
|
||||
@@ -30,7 +38,7 @@ pub trait KagamiSource {
|
||||
&self,
|
||||
owner: &str,
|
||||
token: Option<&str>,
|
||||
filter: &RepositoryFilter,
|
||||
filter: &RepositoryFilterConfig,
|
||||
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
||||
|
||||
fn get_repositories_by_organization(
|
||||
@@ -38,14 +46,14 @@ pub trait KagamiSource {
|
||||
owner: &str,
|
||||
token: Option<&str>,
|
||||
recurse_groups: bool,
|
||||
filter: &RepositoryFilter,
|
||||
filter: &RepositoryFilterConfig,
|
||||
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
||||
|
||||
fn get_repositories_by_stars(
|
||||
&self,
|
||||
owner: &str,
|
||||
token: Option<&str>,
|
||||
filter: &RepositoryFilter,
|
||||
filter: &RepositoryFilterConfig,
|
||||
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
||||
}
|
||||
|
||||
@@ -56,39 +64,6 @@ pub enum RepositoryVisibility {
|
||||
Private,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum RegexFilter {
|
||||
Include(String),
|
||||
Exclude(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RepositoryFilter {
|
||||
pub filter_regex: Vec<RegexFilter>,
|
||||
pub include_forks: bool,
|
||||
pub include_archived: bool,
|
||||
pub min_stars: Option<u32>,
|
||||
pub max_stars: Option<u32>,
|
||||
pub include_public: bool,
|
||||
pub include_internal: bool,
|
||||
pub include_private: bool,
|
||||
}
|
||||
|
||||
impl Default for RepositoryFilter {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
filter_regex: Vec::new(),
|
||||
include_forks: true,
|
||||
include_archived: true,
|
||||
min_stars: None,
|
||||
max_stars: None,
|
||||
include_public: true,
|
||||
include_internal: true,
|
||||
include_private: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RepositoryInfo {
|
||||
pub name: String,
|
||||
|
||||
Reference in New Issue
Block a user