Update flake and deps, continue implementing basic structure
This commit is contained in:
1
src/config.rs
Normal file
1
src/config.rs
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
pub mod config;
|
||||
pub mod sources;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::{CommandFactory, Parser, command};
|
||||
use clap::{CommandFactory, Parser};
|
||||
use clap_complete::{Shell, generate};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
|
||||
82
src/sources.rs
Normal file
82
src/sources.rs
Normal file
@@ -0,0 +1,82 @@
|
||||
pub mod forgejo;
|
||||
pub mod git;
|
||||
pub mod gitea;
|
||||
pub mod github;
|
||||
pub mod gitlab;
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
pub trait KagamiSource {
|
||||
const NAME: &'static str;
|
||||
const DEFAULT_URI_PREFIX: &'static str;
|
||||
|
||||
// Get Repository
|
||||
// - Use native API if available
|
||||
// - Which branches to get
|
||||
// - Which tags to get
|
||||
// - Get LFS objects
|
||||
// - Get Releases
|
||||
// - Get Pull Requests
|
||||
// Get Issues
|
||||
// - Filter by label(s)
|
||||
// - Filter by assignee(s)
|
||||
// - Filter by milestone(s)
|
||||
// - Filter by state (open, closed, all)
|
||||
// Get Wiki
|
||||
|
||||
fn get_repositories_by_user(
|
||||
&self,
|
||||
owner: &str,
|
||||
token: Option<&str>,
|
||||
filter: &RepositoryFilter,
|
||||
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
||||
|
||||
fn get_repositories_by_organization(
|
||||
&self,
|
||||
owner: &str,
|
||||
token: Option<&str>,
|
||||
recurse_groups: bool,
|
||||
filter: &RepositoryFilter,
|
||||
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
||||
|
||||
fn get_repositories_by_stars(
|
||||
&self,
|
||||
owner: &str,
|
||||
token: Option<&str>,
|
||||
filter: &RepositoryFilter,
|
||||
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum RepositoryVisibility {
|
||||
Public,
|
||||
Internal,
|
||||
Private,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum RegexFilter {
|
||||
Include(regex::Regex),
|
||||
Exclude(regex::Regex),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RepositoryFilter {
|
||||
pub filter_regex: Vec<RegexFilter>,
|
||||
pub include_forks: bool,
|
||||
pub include_archived: bool,
|
||||
pub visibility: HashSet<RepositoryVisibility>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RepositoryInfo {
|
||||
pub name: String,
|
||||
pub full_name: String,
|
||||
pub url: String,
|
||||
pub icon_url: Option<String>,
|
||||
pub is_fork: bool,
|
||||
pub is_archived: bool,
|
||||
pub visibility: RepositoryVisibility,
|
||||
pub stars: u32,
|
||||
pub description: Option<String>,
|
||||
}
|
||||
11
src/sources/forgejo.rs
Normal file
11
src/sources/forgejo.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
pub struct KagamiSourceForgejo {
|
||||
host: String,
|
||||
}
|
||||
|
||||
impl KagamiSourceForgejo {
|
||||
pub fn new(host: &str) -> Self {
|
||||
Self {
|
||||
host: host.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
11
src/sources/git.rs
Normal file
11
src/sources/git.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
pub struct KagamiSourceGit {
|
||||
host: String,
|
||||
}
|
||||
|
||||
impl KagamiSourceGitea {
|
||||
pub fn new(host: &str) -> Self {
|
||||
Self {
|
||||
host: host.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
11
src/sources/gitea.rs
Normal file
11
src/sources/gitea.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
pub struct KagamiSourceGitea {
|
||||
host: String,
|
||||
}
|
||||
|
||||
impl KagamiSourceGitea {
|
||||
pub fn new(host: &str) -> Self {
|
||||
Self {
|
||||
host: host.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
11
src/sources/github.rs
Normal file
11
src/sources/github.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
pub struct KagamiSourceGithub {
|
||||
host: String,
|
||||
}
|
||||
|
||||
impl KagamiSourceGithub {
|
||||
pub fn new(host: &str) -> Self {
|
||||
Self {
|
||||
host: host.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
11
src/sources/gitlab.rs
Normal file
11
src/sources/gitlab.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
pub struct KagamiSourceGitlab {
|
||||
host: String,
|
||||
}
|
||||
|
||||
impl KagamiSourceGitlab {
|
||||
pub fn new(host: &str) -> Self {
|
||||
Self {
|
||||
host: host.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user