1
- use crate :: GitProvider ;
2
1
use figment:: {
3
2
providers:: { Format , Serialized , Toml } ,
4
3
Figment ,
@@ -31,12 +30,12 @@ impl Default for Config {
31
30
sources : Some ( vec ! [
32
31
Source {
33
32
name: "github" . to_string( ) ,
34
- provider: GitProvider :: Github ,
33
+ provider: GitProviderType :: Github ,
35
34
url: "https://api.github.com" . to_string( ) ,
36
35
} ,
37
36
Source {
38
37
name: "gitlab" . to_string( ) ,
39
- provider: GitProvider :: Gitlab ,
38
+ provider: GitProviderType :: Gitlab ,
40
39
url: "https://gitlab.com" . to_string( ) ,
41
40
} ,
42
41
] ) ,
@@ -83,6 +82,16 @@ fn git_allowed_signers() -> Option<PathBuf> {
83
82
Some ( path. into ( ) )
84
83
}
85
84
85
+ /// The type of Git provider.
86
+ #[ derive( Debug , Clone , Copy , Deserialize , Serialize , PartialEq , Eq , clap:: ValueEnum ) ]
87
+ #[ serde( rename_all = "lowercase" ) ]
88
+ pub enum GitProviderType {
89
+ /// A Git provider that implements the GitHub API.
90
+ Github ,
91
+ /// A Git provider that implements the GitLab API.
92
+ Gitlab ,
93
+ }
94
+
86
95
#[ derive( Debug , Deserialize , Serialize , PartialEq ) ]
87
96
struct User {
88
97
name : String ,
@@ -98,7 +107,7 @@ struct Organization {
98
107
#[ derive( Debug , Deserialize , Serialize , PartialEq ) ]
99
108
struct Source {
100
109
name : String ,
101
- provider : GitProvider ,
110
+ provider : GitProviderType ,
102
111
url : String ,
103
112
}
104
113
@@ -168,17 +177,17 @@ mod tests {
168
177
sources : Some ( vec ! [
169
178
Source {
170
179
name: "github" . to_string( ) ,
171
- provider: GitProvider :: Github ,
180
+ provider: GitProviderType :: Github ,
172
181
url: "https://api.github.com" . to_string( ) ,
173
182
} ,
174
183
Source {
175
184
name: "gitlab" . to_string( ) ,
176
- provider: GitProvider :: Gitlab ,
185
+ provider: GitProviderType :: Gitlab ,
177
186
url: "https://gitlab.com" . to_string( ) ,
178
187
} ,
179
188
Source {
180
189
name: "acme-corp" . to_string( ) ,
181
- provider: GitProvider :: Gitlab ,
190
+ provider: GitProviderType :: Gitlab ,
182
191
url: "https://git.acme.corp" . to_string( ) ,
183
192
} ,
184
193
] )
0 commit comments