From 30d00301b0bfdfb04664a5d5dbb9b20bbee13842 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Wed, 30 Dec 2020 09:32:42 +0000 Subject: [PATCH] Added identity_file to top-level group --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index a092aa0..c16460e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,7 @@ struct ServerMapping { struct ServerGroup { name: String, servers: Vec, + identity_file: Option, } #[derive(Debug, PartialEq, Deserialize)] @@ -125,7 +126,7 @@ fn main() { println!("{}:", group.name); } - for server in group.servers { + for mut server in group.servers { if config_list { println!(" - {}", server.name); continue; @@ -133,6 +134,11 @@ fn main() { 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); } }