This commit is contained in:
figsoda 2022-12-31 20:20:02 -05:00
parent 70c088f374
commit a313c21a8a
6 changed files with 16 additions and 16 deletions

View File

@ -13,7 +13,7 @@
- `--list-fetchers` to list all available fetchers
- `--list-possible-fetchers` to list all fetchers that can be generated without `--fetcher`
- Support for the following fetchers
- `fetchBitBucket` (<https://bitbucket.org>)
- `fetchFromBitbucket` (<https://bitbucket.org>)
- `fetchFromGitea` (and <https://codeberg.org>)
- `fetchFromGitiles` (and <https://googlesource.com>)
- `fetchFromRepoOrCz` (<https://repo.or.cz>)

View File

@ -20,7 +20,7 @@ fetchFromGitHub {
## Supported Fetchers
- fetchFromBitBucket
- fetchFromBitbucket
- fetchFromGitHub
- fetchFromGitLab
- fetchFromGitea
@ -40,7 +40,7 @@ Arguments:
[REV] the revision or reference to be fetched
Options:
-f, --fetcher <FETCHER> specify the fetcher function instead of inferring from the URL [possible values: fetchFromBitBucket, fetchFromGitHub, fetchFromGitLab, fetchFromGitea, fetchFromGitiles, fetchFromRepoOrCz, fetchFromSourcehut, fetchgit, fetchhg]
-f, --fetcher <FETCHER> specify the fetcher function instead of inferring from the URL [possible values: fetchFromBitbucket, fetchFromGitHub, fetchFromGitLab, fetchFromGitea, fetchFromGitiles, fetchFromRepoOrCz, fetchFromSourcehut, fetchgit, fetchhg]
-i, --indent <INDENT> extra indentation (in number of spaces) [default: 0]
-j, --json output in json format
-a, --arg <KEY> <VALUE> additional arguments to pass to the fetcher

View File

@ -50,7 +50,7 @@ pub struct Opts {
#[derive(Clone, Debug, ValueEnum)]
#[clap(rename_all = "camelCase")]
pub enum FetcherFunction {
FetchFromBitBucket,
FetchFromBitbucket,
FetchFromGitHub,
FetchFromGitLab,
FetchFromGitea,

View File

@ -3,15 +3,15 @@ use crate::{
simple::{SimpleFetcher, SimpleUrlFetcher},
};
pub struct FetchFromBitBucket;
impl_fetcher!(FetchFromBitBucket);
pub struct FetchFromBitbucket;
impl_fetcher!(FetchFromBitbucket);
impl<'a> SimpleFetcher<'a> for FetchFromBitBucket {
impl<'a> SimpleFetcher<'a> for FetchFromBitbucket {
const KEYS: [&'static str; 2] = ["owner", "repo"];
const NAME: &'static str = "fetchFromBitBucket";
const NAME: &'static str = "fetchFromBitbucket";
}
impl<'a> SimpleUrlFetcher<'a> for FetchFromBitBucket {
impl<'a> SimpleUrlFetcher<'a> for FetchFromBitbucket {
fn get_url(&self, [owner, repo]: [&str; 2], rev: &str) -> String {
format!("https://bitbucket.org/{owner}/{repo}/get/{rev}.tar.gz")
}

View File

@ -8,7 +8,7 @@ mod hg;
mod repo_or_cz;
mod sourcehut;
pub use bitbucket::FetchFromBitBucket;
pub use bitbucket::FetchFromBitbucket;
pub use git::Fetchgit;
pub use gitea::FetchFromGitea;
pub use github::FetchFromGitHub;
@ -45,7 +45,7 @@ pub trait Fetcher {
#[enum_dispatch(Fetcher)]
pub enum FetcherDispatch<'a> {
FetchFromBitBucket(FetchFromBitBucket),
FetchFromBitbucket(FetchFromBitbucket),
FetchFromGitHub(FetchFromGitHub<'a>),
FetchFromGitLab(FetchFromGitLab<'a>),
FetchFromGitea(FetchFromGitea<'a>),

View File

@ -12,7 +12,7 @@ use itertools::Itertools;
use crate::{
cli::{FetcherFunction, Opts},
fetcher::{
FetchFromBitBucket, FetchFromGitHub, FetchFromGitLab, FetchFromGitea, FetchFromGitiles,
FetchFromBitbucket, FetchFromGitHub, FetchFromGitLab, FetchFromGitea, FetchFromGitiles,
FetchFromRepoOrCz, FetchFromSourcehut, Fetcher, FetcherDispatch, Fetchgit, Fetchhg,
},
};
@ -36,11 +36,11 @@ fn main() -> Result<()> {
}
let fetcher: FetcherDispatch = match (opts.fetcher, opts.url.host_str()) {
(None | Some(FetcherFunction::FetchFromBitBucket), Some("bitbucket.org")) => {
FetchFromBitBucket.into()
(None | Some(FetcherFunction::FetchFromBitbucket), Some("bitbucket.org")) => {
FetchFromBitbucket.into()
}
(Some(FetcherFunction::FetchFromBitBucket), _) => {
bail!("fetchFromBitBucket only supports bitbucket.org");
(Some(FetcherFunction::FetchFromBitbucket), _) => {
bail!("fetchFromBitbucket only supports bitbucket.org");
}
(None | Some(FetcherFunction::FetchFromGitHub), Some("github.com")) => {