From 194be9c9b550b39544216adbe1e4ad440ab3caf2 Mon Sep 17 00:00:00 2001 From: Paul Woolcock Date: Mon, 12 Feb 2018 12:21:22 -0500 Subject: [PATCH] Add `Gitlab` to the RepoSite enum --- src/models/repo.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/models/repo.rs b/src/models/repo.rs index d70a1c1..daef7cd 100644 --- a/src/models/repo.rs +++ b/src/models/repo.rs @@ -27,13 +27,15 @@ impl RepoPath { #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] pub enum RepoSite { - Github + Github, + Gitlab, } impl RepoSite { pub fn to_base_uri(&self) -> &'static str { match self { - &RepoSite::Github => "https://github.com" + &RepoSite::Github => "https://github.com", + &RepoSite::Gitlab => "https://gitlab.com" } } } @@ -44,6 +46,7 @@ impl FromStr for RepoSite { fn from_str(input: &str) -> Result { match input { "github" => Ok(RepoSite::Github), + "gitlab" => Ok(RepoSite::Gitlab), _ => Err(format_err!("unknown repo site identifier")) } } @@ -52,7 +55,8 @@ impl FromStr for RepoSite { impl AsRef for RepoSite { fn as_ref(&self) -> &str { match self { - &RepoSite::Github => "github" + &RepoSite::Github => "github", + &RepoSite::Gitlab => "gitlab" } } }