forge: Use "origin" as the default remote name

Close #33
This commit is contained in:
2022-06-15 20:49:13 +02:00
parent 9fc34e6989
commit 27ef86c1b4
4 changed files with 14 additions and 23 deletions

View File

@@ -8,7 +8,6 @@ use super::JsonError;
use super::Project;
use super::Provider;
const PROVIDER_NAME: &str = "github";
const ACCEPT_HEADER_JSON: &str = "application/vnd.github.v3+json";
const GITHUB_API_BASEURL: &str =
option_env!("GITHUB_API_BASEURL").unwrap_or("https://api.github.com");
@@ -88,10 +87,6 @@ impl Provider for Github {
})
}
fn name(&self) -> &str {
PROVIDER_NAME
}
fn filter(&self) -> &Filter {
&self.filter
}

View File

@@ -8,7 +8,6 @@ use super::JsonError;
use super::Project;
use super::Provider;
const PROVIDER_NAME: &str = "gitlab";
const ACCEPT_HEADER_JSON: &str = "application/json";
const GITLAB_API_BASEURL: &str = option_env!("GITLAB_API_BASEURL").unwrap_or("https://gitlab.com");
@@ -105,10 +104,6 @@ impl Provider for Gitlab {
})
}
fn name(&self) -> &str {
PROVIDER_NAME
}
fn filter(&self) -> &Filter {
&self.filter
}

View File

@@ -14,6 +14,8 @@ use super::repo;
use std::collections::HashMap;
const DEFAULT_REMOTE_NAME: &str = "origin";
#[derive(Debug, Deserialize, Serialize, clap::ArgEnum, Clone)]
pub enum RemoteProvider {
#[serde(alias = "github", alias = "GitHub")]
@@ -122,7 +124,6 @@ pub trait Provider {
where
Self: Sized;
fn name(&self) -> &str;
fn filter(&self) -> &Filter;
fn secret_token(&self) -> &auth::AuthToken;
fn auth_header_key() -> &'static str;
@@ -293,7 +294,7 @@ pub trait Provider {
let mut ret: HashMap<Option<String>, Vec<repo::Repo>> = HashMap::new();
let remote_name = remote_name.unwrap_or_else(|| self.name().to_string());
let remote_name = remote_name.unwrap_or_else(|| DEFAULT_REMOTE_NAME.to_string());
for repo in repos {
let namespace = repo.namespace();