Update flake and deps, continue implementing basic structure
This commit is contained in:
2766
Cargo.lock
generated
2766
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -4,9 +4,17 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.100"
|
||||
clap = { version = "4.5.35", features = ["derive"] }
|
||||
clap_complete = "4.5.47"
|
||||
forgejo-api = { version = "0.9.0", default-features = false, features = ["rustls-tls"] }
|
||||
gitea-sdk = "0.6.0"
|
||||
gitlab = "0.1807.0"
|
||||
gix = "0.70.0"
|
||||
octocrab = "0.49.5"
|
||||
regex = "1.12.2"
|
||||
reqwest = "0.13.1"
|
||||
sd-notify = "0.4.5"
|
||||
tokio = { version = "1.49.0", features = ["rt-multi-thread"] }
|
||||
tracing = "0.1.41"
|
||||
tracing-journald = "0.3.1"
|
||||
|
||||
12
flake.lock
generated
12
flake.lock
generated
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1743583204,
|
||||
"narHash": "sha256-F7n4+KOIfWrwoQjXrL2wD9RhFYLs2/GGe/MQY1sSdlE=",
|
||||
"lastModified": 1768305791,
|
||||
"narHash": "sha256-AIdl6WAn9aymeaH/NvBj0H9qM+XuAuYbGMZaP0zcXAQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2c8d3f48d33929642c1c12cd243df4cc7d2ce434",
|
||||
"rev": "1412caf7bf9e660f2f962917c14b1ea1c3bc695e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -29,11 +29,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1743647602,
|
||||
"narHash": "sha256-fXd8fA6HR7MlUJQzz31zjBzUji4HpGCJ7CMVKSZOe8c=",
|
||||
"lastModified": 1768445213,
|
||||
"narHash": "sha256-y0BglISgDr61vvdb35m0O4npuqh1pojlBNDILo9j8AI=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "5b2d60b2e25bcb498103f6fae08da561f6b671da",
|
||||
"rev": "1cd63408e71cc0e6a89ff2cb7c4107214e2523cc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -33,9 +33,13 @@
|
||||
in {
|
||||
devShells = forAllSystems (system: pkgs: toolchain: {
|
||||
default = pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
nativeBuildInputs = with pkgs; [
|
||||
toolchain
|
||||
pkgs.gitoxide
|
||||
|
||||
cargo-edit
|
||||
gitoxide
|
||||
pkg-config
|
||||
openssl
|
||||
];
|
||||
|
||||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||
|
||||
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