Skip to content

Commit

Permalink
Added identity_file to top-level group
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellockyer committed Dec 30, 2020
1 parent 7e288e4 commit 30d0030
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct ServerMapping {
struct ServerGroup {
name: String,
servers: Vec<Server>,
identity_file: Option<String>,
}

#[derive(Debug, PartialEq, Deserialize)]
Expand Down Expand Up @@ -125,14 +126,19 @@ fn main() {
println!("{}:", group.name);
}

for server in group.servers {
for mut server in group.servers {
if config_list {
println!(" - {}", server.name);
continue;
}

if let Some(config_name) = config_name {
if config_name == server.name {
if server.identity_file.is_empty() {
if let Some(ref group_identity) = group.identity_file {
server.identity_file = group_identity.to_string();
}
}
server_found = Some(server);
}
}
Expand Down

0 comments on commit 30d0030

Please sign in to comment.