feat: setup forgeflux forge type in DB
This commit is contained in:
parent
66e9ec20f9
commit
d1606fa2ac
1 changed files with 5 additions and 0 deletions
|
@ -309,6 +309,8 @@ impl Clone for Box<dyn SCDatabase> {
|
|||
pub enum ForgeImplementation {
|
||||
/// [Gitea](https://gitea.io) softare forge
|
||||
Gitea,
|
||||
/// [ForgeFlux](https://net.forgeflux.net)
|
||||
ForgeFlux,
|
||||
}
|
||||
|
||||
impl ForgeImplementation {
|
||||
|
@ -316,6 +318,7 @@ impl ForgeImplementation {
|
|||
pub const fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
ForgeImplementation::Gitea => "gitea",
|
||||
ForgeImplementation::ForgeFlux => "forgeflux",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -326,9 +329,11 @@ impl FromStr for ForgeImplementation {
|
|||
/// Convert [str] to [ForgeImplementation]
|
||||
fn from_str(s: &str) -> DBResult<Self> {
|
||||
const GITEA: &str = ForgeImplementation::Gitea.to_str();
|
||||
const FORGEFLUX: &str = ForgeImplementation::ForgeFlux.to_str();
|
||||
let s = s.trim();
|
||||
match s {
|
||||
GITEA => Ok(Self::Gitea),
|
||||
FORGEFLUX => Ok(Self::ForgeFlux),
|
||||
_ => Err(DBError::UnknownForgeType(s.to_owned())),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue