aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/config.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/ssh/config.go b/lib/ssh/config.go
index 13773586..e3f4c930 100644
--- a/lib/ssh/config.go
+++ b/lib/ssh/config.go
@@ -266,6 +266,21 @@ func (cfg *Config) Get(s string) (section *ConfigSection) {
return nil
}
+//
+// Prepend other Config's sections to this Config.
+// The other's sections will be at the top of the list.
+//
+// This function can be useful if we want to load another SSH config file
+// without using Include directive.
+//
+func (cfg *Config) Prepend(other *Config) {
+ newSections := make([]*ConfigSection, 0,
+ len(cfg.sections)+len(other.sections))
+ newSections = append(newSections, other.sections...)
+ newSections = append(newSections, cfg.sections...)
+ cfg.sections = newSections
+}
+
func parseBool(key, val string) (out bool, err error) {
switch val {
case valueNo: