sort fetchers

This commit is contained in:
figsoda 2022-12-31 15:54:11 -05:00
parent a1d664e45e
commit b495a23e6c
3 changed files with 12 additions and 12 deletions

View File

@ -51,9 +51,9 @@ pub struct Opts {
#[clap(rename_all = "camelCase")] #[clap(rename_all = "camelCase")]
pub enum FetcherFunction { pub enum FetcherFunction {
FetchFromBitBucket, FetchFromBitBucket,
FetchFromGitea,
FetchFromGitHub, FetchFromGitHub,
FetchFromGitLab, FetchFromGitLab,
FetchFromGitea,
FetchFromSourcehut, FetchFromSourcehut,
Fetchgit, Fetchgit,
Fetchhg, Fetchhg,

View File

@ -42,9 +42,9 @@ pub trait Fetcher {
#[enum_dispatch(Fetcher)] #[enum_dispatch(Fetcher)]
pub enum FetcherDispatch { pub enum FetcherDispatch {
FetchFromBitBucket(FetchFromBitBucket), FetchFromBitBucket(FetchFromBitBucket),
FetchFromGitea(FetchFromGitea),
FetchFromGitHub(FetchFromGitHub), FetchFromGitHub(FetchFromGitHub),
FetchFromGitLab(FetchFromGitLab), FetchFromGitLab(FetchFromGitLab),
FetchFromGitea(FetchFromGitea),
FetchFromSourcehut(FetchFromSourcehut), FetchFromSourcehut(FetchFromSourcehut),
Fetchgit(Fetchgit), Fetchgit(Fetchgit),
Fetchhg(Fetchhg), Fetchhg(Fetchhg),

View File

@ -43,14 +43,6 @@ fn main() -> Result<()> {
bail!("fetchFromBitBucket only supports bitbucket.org"); bail!("fetchFromBitBucket only supports bitbucket.org");
} }
(
None | Some(FetcherFunction::FetchFromGitea),
Some(Host::Domain(host @ "codeberg.org")),
) => FetchFromGitea(host.into()).into(),
(Some(FetcherFunction::FetchFromGitea), Some(host)) => {
FetchFromGitea(host.to_string()).into()
}
(None | Some(FetcherFunction::FetchFromGitHub), Some(Host::Domain("github.com"))) => { (None | Some(FetcherFunction::FetchFromGitHub), Some(Host::Domain("github.com"))) => {
FetchFromGitHub(None).into() FetchFromGitHub(None).into()
} }
@ -68,6 +60,14 @@ fn main() -> Result<()> {
FetchFromGitLab(Some(host.to_string())).into() FetchFromGitLab(Some(host.to_string())).into()
} }
(
None | Some(FetcherFunction::FetchFromGitea),
Some(Host::Domain(host @ "codeberg.org")),
) => FetchFromGitea(host.into()).into(),
(Some(FetcherFunction::FetchFromGitea), Some(host)) => {
FetchFromGitea(host.to_string()).into()
}
(None | Some(FetcherFunction::FetchFromSourcehut), Some(Host::Domain("git.sr.ht"))) => { (None | Some(FetcherFunction::FetchFromSourcehut), Some(Host::Domain("git.sr.ht"))) => {
FetchFromSourcehut(None).into() FetchFromSourcehut(None).into()
} }
@ -77,9 +77,9 @@ fn main() -> Result<()> {
( (
Some( Some(
fetcher @ (FetcherFunction::FetchFromGitea fetcher @ (FetcherFunction::FetchFromGitHub
| FetcherFunction::FetchFromGitHub
| FetcherFunction::FetchFromGitLab | FetcherFunction::FetchFromGitLab
| FetcherFunction::FetchFromGitea
| FetcherFunction::FetchFromSourcehut), | FetcherFunction::FetchFromSourcehut),
), ),
None, None,