Compare commits
No commits in common. "a3c52c77611588676b4aff589375b3b0665b33ab" and "cd8d2369409cfcfb2bc349fb3402ae627885213d" have entirely different histories.
a3c52c7761
...
cd8d236940
2 changed files with 12 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
|||
[forge.default]
|
||||
forge_type = "forgejo"
|
||||
hostname = "git.example.net"
|
||||
type = "forgejo"
|
||||
url = "https://git.example.net"
|
||||
user = "git-next" # the user to perform actions as
|
||||
# API token for user?
|
||||
# path to private SSH key for user?
|
||||
|
|
|
@ -5,8 +5,8 @@ use crate::filesystem::FileSystem;
|
|||
|
||||
#[derive(Debug, PartialEq, Eq, Deserialize)]
|
||||
pub struct Config {
|
||||
forge_type: ForgeType,
|
||||
hostname: String,
|
||||
r#type: ForgeType,
|
||||
url: String,
|
||||
user: String,
|
||||
// API Token
|
||||
// Private SSH Key Path
|
||||
|
@ -26,11 +26,11 @@ impl Config {
|
|||
let str = fs.read_file("git-next-server.toml").map_err(OneOf::new)?;
|
||||
toml::from_str(&str).map_err(OneOf::new)
|
||||
}
|
||||
pub const fn forge_type(&self) -> &ForgeType {
|
||||
&self.forge_type
|
||||
pub const fn r#type(&self) -> &ForgeType {
|
||||
&self.r#type
|
||||
}
|
||||
pub fn hostname(&self) -> &str {
|
||||
self.hostname.as_str()
|
||||
pub fn url(&self) -> &str {
|
||||
self.url.as_str()
|
||||
}
|
||||
pub fn user(&self) -> &str {
|
||||
self.user.as_str()
|
||||
|
@ -49,15 +49,15 @@ mod tests {
|
|||
fs.write_file(
|
||||
"git-next-server.toml",
|
||||
r#"
|
||||
forge_type = "ForgeJo"
|
||||
hostname = "git.example.net"
|
||||
type = "ForgeJo"
|
||||
url = "https://forge.jo"
|
||||
user = "Bob"
|
||||
"#,
|
||||
)
|
||||
.map_err(OneOf::new)?;
|
||||
let config = Config::load(&fs)?;
|
||||
assert_eq!(config.forge_type(), &ForgeType::ForgeJo);
|
||||
assert_eq!(config.hostname(), "git.example.net".to_string());
|
||||
assert_eq!(config.r#type(), &ForgeType::ForgeJo);
|
||||
assert_eq!(config.url(), "https://forge.jo".to_string());
|
||||
assert_eq!(config.user(), "Bob".to_string());
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue