mirror of
https://github.com/nix-community/nurl.git
synced 2024-09-11 18:39:19 +03:00
sort fetchers
This commit is contained in:
parent
a1d664e45e
commit
b495a23e6c
@ -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,
|
||||||
|
@ -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),
|
||||||
|
20
src/main.rs
20
src/main.rs
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user